Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681383 > unrolled thread

[PATCH] sched/fair: fix contribution calculation

Started byGanesh Mahendran <opensource.ganesh@gmail.com>
First post2017-07-05 10:50 +0200
Last post2017-07-06 03:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sched/fair: fix contribution calculation Ganesh Mahendran <opensource.ganesh@gmail.com> - 2017-07-05 10:50 +0200
    Re: [PATCH] sched/fair: fix contribution calculation Peter Zijlstra <peterz@infradead.org> - 2017-07-05 14:00 +0200
      Re: [PATCH] sched/fair: fix contribution calculation Ganesh Mahendran <opensource.ganesh@gmail.com> - 2017-07-06 03:50 +0200

#1681383 — [PATCH] sched/fair: fix contribution calculation

FromGanesh Mahendran <opensource.ganesh@gmail.com>
Date2017-07-05 10:50 +0200
Subject[PATCH] sched/fair: fix contribution calculation
Message-ID<tZOau-3Wl-27@gated-at.bofh.it>
Function __compute_runnable_contrib() is to calculate:
   \Sum 1024*y^n {for (1..n_period)}
But LOAD_AVG_MAX returns sum of 1024*y^n (0..n_period).
So we need to subtract 1024*y^0.

Cc: stable@vger.kernel.org
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 90e26b1..777ad49 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2508,7 +2508,7 @@ static u32 __compute_runnable_contrib(u64 n)
 	if (likely(n <= LOAD_AVG_PERIOD))
 		return runnable_avg_yN_sum[n];
 	else if (unlikely(n >= LOAD_AVG_MAX_N))
-		return LOAD_AVG_MAX;
+		return LOAD_AVG_MAX - 1024;
 
 	/* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */
 	do {
-- 
1.9.1

[toc] | [next] | [standalone]


#1681488

FromPeter Zijlstra <peterz@infradead.org>
Date2017-07-05 14:00 +0200
Message-ID<tZR8m-5K7-23@gated-at.bofh.it>
In reply to#1681383
On Wed, Jul 05, 2017 at 04:46:30PM +0800, Ganesh Mahendran wrote:
> Function __compute_runnable_contrib() is to calculate:
>    \Sum 1024*y^n {for (1..n_period)}
> But LOAD_AVG_MAX returns sum of 1024*y^n (0..n_period).
> So we need to subtract 1024*y^0.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> ---
>  kernel/sched/fair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 90e26b1..777ad49 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2508,7 +2508,7 @@ static u32 __compute_runnable_contrib(u64 n)
>  	if (likely(n <= LOAD_AVG_PERIOD))
>  		return runnable_avg_yN_sum[n];
>  	else if (unlikely(n >= LOAD_AVG_MAX_N))
> -		return LOAD_AVG_MAX;
> +		return LOAD_AVG_MAX - 1024;
>  
>  	/* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */
>  	do {


This code no longer exists...

[toc] | [prev] | [next] | [standalone]


#1682005

FromGanesh Mahendran <opensource.ganesh@gmail.com>
Date2017-07-06 03:50 +0200
Message-ID<u045B-5Wp-37@gated-at.bofh.it>
In reply to#1681488
Hello, Peter:

2017-07-05 19:59 GMT+08:00 Peter Zijlstra <peterz@infradead.org>:
> On Wed, Jul 05, 2017 at 04:46:30PM +0800, Ganesh Mahendran wrote:
>> Function __compute_runnable_contrib() is to calculate:
>>    \Sum 1024*y^n {for (1..n_period)}
>> But LOAD_AVG_MAX returns sum of 1024*y^n (0..n_period).
>> So we need to subtract 1024*y^0.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
>> ---
>>  kernel/sched/fair.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 90e26b1..777ad49 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -2508,7 +2508,7 @@ static u32 __compute_runnable_contrib(u64 n)
>>       if (likely(n <= LOAD_AVG_PERIOD))
>>               return runnable_avg_yN_sum[n];
>>       else if (unlikely(n >= LOAD_AVG_MAX_N))
>> -             return LOAD_AVG_MAX;
>> +             return LOAD_AVG_MAX - 1024;
>>
>>       /* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */
>>       do {
>
>
> This code no longer exists...

Yes, you are right. The latest kernel has fix this.
Do we need to fix this in LTS 4.1, 4.4?

Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web