public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix contribution calculation
@ 2017-07-05  8:46 Ganesh Mahendran
  2017-07-05 11:59 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Ganesh Mahendran @ 2017-07-05  8:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, stable, Ganesh Mahendran

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-06  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-05  8:46 [PATCH] sched/fair: fix contribution calculation Ganesh Mahendran
2017-07-05 11:59 ` Peter Zijlstra
2017-07-06  1:39   ` Ganesh Mahendran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox