summaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-11-12 16:19:00 +0530
committerIngo Molnar <mingo@elte.hu>2008-11-12 12:33:50 +0100
commita2d477778e82a60a0b7114cefdb70aa43af28782 (patch)
tree52fb05ee2d63765ddddcf4a2e06f310510607735 /kernel/sched.c
parentf21f237cf55494c3a4209de323281a3b0528da10 (diff)
downloadop-kernel-dev-a2d477778e82a60a0b7114cefdb70aa43af28782.zip
op-kernel-dev-a2d477778e82a60a0b7114cefdb70aa43af28782.tar.gz
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 <balbir@linux.vnet.ibm.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 50a21f9..3bafbe3 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;
}
OpenPOWER on IntegriCloud