diff mbox

[v5,06/12] sched: add per rq cpu_capacity_orig

Message ID 1409051215-16788-7-git-send-email-vincent.guittot@linaro.org
State New
Headers show

Commit Message

Vincent Guittot Aug. 26, 2014, 11:06 a.m. UTC
This new field cpu_capacity_orig reflects the available capacity of a CPUs
unlike the cpu_capacity which reflects the current capacity that can be altered
by frequency and rt tasks.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/core.c  | 2 +-
 kernel/sched/fair.c  | 1 +
 kernel/sched/sched.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

Comments

Kamalesh Babulal Aug. 27, 2014, 1:32 p.m. UTC | #1
* Vincent Guittot <vincent.guittot@linaro.org> [2014-08-26 13:06:49]:

> This new field cpu_capacity_orig reflects the available capacity of a CPUs
> unlike the cpu_capacity which reflects the current capacity that can be altered
> by frequency and rt tasks.
> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>

Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Vincent Guittot Aug. 28, 2014, 7:34 a.m. UTC | #2
On 27 August 2014 15:32, Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:
> * Vincent Guittot <vincent.guittot@linaro.org> [2014-08-26 13:06:49]:
>
>> This new field cpu_capacity_orig reflects the available capacity of a CPUs
>> unlike the cpu_capacity which reflects the current capacity that can be altered
>> by frequency and rt tasks.
>>
>> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
>
> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>

Thanks

>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Peter Zijlstra Sept. 10, 2014, 1:53 p.m. UTC | #3
On Tue, Aug 26, 2014 at 01:06:49PM +0200, Vincent Guittot wrote:
> This new field cpu_capacity_orig reflects the available capacity of a CPUs
> unlike the cpu_capacity which reflects the current capacity that can be altered
> by frequency and rt tasks.
> 

No real objection to the patch as such, but the Changelog fails to tell
us why you want this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Nicolas Pitre Sept. 11, 2014, 7:02 p.m. UTC | #4
On Tue, 26 Aug 2014, Vincent Guittot wrote:

> This new field cpu_capacity_orig reflects the available capacity of a CPUs

s/a CPUs/a CPU/

> unlike the cpu_capacity which reflects the current capacity that can be altered
> by frequency and rt tasks.

Shouldn't this be described as the "highest possible capacity" instead 
of only "available capacity" to make it clearer?  In which case, 
shouldn't it be called capacity_max instead of capacity_orig?  With 
"orig" we may think "origin" as the capacity that was available at boot 
time or the like.  If for example the CPU was booted with a low P-state 
then its max capacity is different from the original one.


> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  kernel/sched/core.c  | 2 +-
>  kernel/sched/fair.c  | 1 +
>  kernel/sched/sched.h | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a394f99..7c3b237 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7003,7 +7003,7 @@ void __init sched_init(void)
>  #ifdef CONFIG_SMP
>  		rq->sd = NULL;
>  		rq->rd = NULL;
> -		rq->cpu_capacity = SCHED_CAPACITY_SCALE;
> +		rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
>  		rq->post_schedule = 0;
>  		rq->active_balance = 0;
>  		rq->next_balance = jiffies;
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 8176bda..17c16cc 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5756,6 +5756,7 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)
>  
>  	capacity >>= SCHED_CAPACITY_SHIFT;
>  
> +	cpu_rq(cpu)->cpu_capacity_orig = capacity;
>  	sdg->sgc->capacity_orig = capacity;
>  
>  	if (sched_feat(ARCH_CAPACITY))
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index aa0f73b..7c0a74e 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -575,6 +575,7 @@ struct rq {
>  	struct sched_domain *sd;
>  
>  	unsigned long cpu_capacity;
> +	unsigned long cpu_capacity_orig;
>  
>  	unsigned char idle_balance;
>  	/* For active balancing */
> -- 
> 1.9.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Vincent Guittot Sept. 15, 2014, 9:22 p.m. UTC | #5
On 11 September 2014 21:02, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Tue, 26 Aug 2014, Vincent Guittot wrote:
>
>> This new field cpu_capacity_orig reflects the available capacity of a CPUs
>
> s/a CPUs/a CPU/

good catch

>
>> unlike the cpu_capacity which reflects the current capacity that can be altered
>> by frequency and rt tasks.
>
> Shouldn't this be described as the "highest possible capacity" instead
> of only "available capacity" to make it clearer?  In which case,
> shouldn't it be called capacity_max instead of capacity_orig?  With
> "orig" we may think "origin" as the capacity that was available at boot
> time or the like.  If for example the CPU was booted with a low P-state
> then its max capacity is different from the original one.

I have use the orig suffix to be aligned with the capacity_orig which
is a sum of cpu_capacity_orig.
I agree that orig is standing for original in the sense that it's the
original capacity befor being altered by scale_freq and scale_rt

Vincent
>
>
>>
>> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
>> ---
>>  kernel/sched/core.c  | 2 +-
>>  kernel/sched/fair.c  | 1 +
>>  kernel/sched/sched.h | 1 +
>>  3 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index a394f99..7c3b237 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -7003,7 +7003,7 @@ void __init sched_init(void)
>>  #ifdef CONFIG_SMP
>>               rq->sd = NULL;
>>               rq->rd = NULL;
>> -             rq->cpu_capacity = SCHED_CAPACITY_SCALE;
>> +             rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
>>               rq->post_schedule = 0;
>>               rq->active_balance = 0;
>>               rq->next_balance = jiffies;
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 8176bda..17c16cc 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -5756,6 +5756,7 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)
>>
>>       capacity >>= SCHED_CAPACITY_SHIFT;
>>
>> +     cpu_rq(cpu)->cpu_capacity_orig = capacity;
>>       sdg->sgc->capacity_orig = capacity;
>>
>>       if (sched_feat(ARCH_CAPACITY))
>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> index aa0f73b..7c0a74e 100644
>> --- a/kernel/sched/sched.h
>> +++ b/kernel/sched/sched.h
>> @@ -575,6 +575,7 @@ struct rq {
>>       struct sched_domain *sd;
>>
>>       unsigned long cpu_capacity;
>> +     unsigned long cpu_capacity_orig;
>>
>>       unsigned char idle_balance;
>>       /* For active balancing */
>> --
>> 1.9.1
>>
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a394f99..7c3b237 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7003,7 +7003,7 @@  void __init sched_init(void)
 #ifdef CONFIG_SMP
 		rq->sd = NULL;
 		rq->rd = NULL;
-		rq->cpu_capacity = SCHED_CAPACITY_SCALE;
+		rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
 		rq->post_schedule = 0;
 		rq->active_balance = 0;
 		rq->next_balance = jiffies;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8176bda..17c16cc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5756,6 +5756,7 @@  static void update_cpu_capacity(struct sched_domain *sd, int cpu)
 
 	capacity >>= SCHED_CAPACITY_SHIFT;
 
+	cpu_rq(cpu)->cpu_capacity_orig = capacity;
 	sdg->sgc->capacity_orig = capacity;
 
 	if (sched_feat(ARCH_CAPACITY))
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index aa0f73b..7c0a74e 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -575,6 +575,7 @@  struct rq {
 	struct sched_domain *sd;
 
 	unsigned long cpu_capacity;
+	unsigned long cpu_capacity_orig;
 
 	unsigned char idle_balance;
 	/* For active balancing */