From: Balbir Singh Date: Wed, 12 Nov 2008 10:49:00 +0000 (+0530) Subject: sched: fix stale value in average load per task X-Git-Tag: v2.6.28-rc5~23^2~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a2d477778e82a60a0b7114cefdb70aa43af28782;p=linux-2.6-omap-h63xx.git sched: fix stale value in average load per task Impact: fix load balancer load average calculation accuracy cpu_avg_load_per_task() returns a stale value when nr_running is 0. It returns an older stale (caculated when nr_running was non zero) value. This patch returns and sets rq->avg_load_per_task to zero when nr_running is 0. Compile and boot tested on a x86_64 box. Signed-off-by: Balbir Singh Acked-by: Peter Zijlstra Signed-off-by: Ingo Molnar --- diff --git a/kernel/sched.c b/kernel/sched.c index 50a21f96467..3bafbe350f4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1456,6 +1456,8 @@ static unsigned long cpu_avg_load_per_task(int cpu) if (rq->nr_running) rq->avg_load_per_task = rq->load.weight / rq->nr_running; + else + rq->avg_load_per_task = 0; return rq->avg_load_per_task; }