[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081112104900.GA13896@balbir.in.ibm.com>
Date: Wed, 12 Nov 2008 16:19:00 +0530
From: Balbir Singh <balbir@...ux.vnet.ibm.com>
To: Ingo Molnar <mingo@...e.hu>,
Linux Kernel <linux-kernel@...r.kernel.org>
Cc: Dhaval Giani <dhaval@...ux.vnet.ibm.com>,
Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>,
Vaidyanathan S <svaidyan@...ibm.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Bharata B Rao <bharata@...ux.vnet.ibm.com>
Subject: [PATCH][mmotm] Sched fix stale value in average load per task
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@...ux.vnet.ibm.com>
---
kernel/sched.c | 2 ++
1 file changed, 2 insertions(+)
diff -puN kernel/sched.c~sched-fix-stale-load-avg kernel/sched.c
--- linux-2.6.28-rc4/kernel/sched.c~sched-fix-stale-load-avg 2008-11-12 15:55:38.000000000 +0530
+++ linux-2.6.28-rc4-balbir/kernel/sched.c 2008-11-12 15:56:09.000000000 +0530
@@ -1430,6 +1430,8 @@ static unsigned long cpu_avg_load_per_ta
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;
}
_
--
Balbir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists