From: Nick Piggin <nickpiggin@yahoo.com.au>

"Siddha, Suresh B" <suresh.b.siddha@intel.com> noticed a problem in the
cpu_load averaging where the integer truncation could sometimes cause cpu_load
to never quite reach its target.

I'm not sure that you could demonstrate a real world problem, but I quite
like this fix.


---

 25-akpm/kernel/sched.c |    7 +++++++
 1 files changed, 7 insertions(+)

diff -puN kernel/sched.c~sched-loadup-roundup kernel/sched.c
--- 25/kernel/sched.c~sched-loadup-roundup	Wed May 12 15:45:20 2004
+++ 25-akpm/kernel/sched.c	Wed May 12 15:45:20 2004
@@ -1854,6 +1854,13 @@ static void rebalance_tick(int this_cpu,
 	/* Update our load */
 	old_load = this_rq->cpu_load;
 	this_load = this_rq->nr_running * SCHED_LOAD_SCALE;
+	/*
+	 * Round up the averaging division if load is increasing. This
+	 * prevents us from getting stuck on 9 if the load is 10, for
+	 * example.
+	 */
+	if (this_load > old_load)
+		old_load++;
 	this_rq->cpu_load = (old_load + this_load) / 2;
 
 	for_each_domain(this_cpu, sd) {

_