Commit b75125de authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sched: improved cpu_load rounding

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.
parent 3d48f700
......@@ -1854,6 +1854,13 @@ static void rebalance_tick(int this_cpu, runqueue_t *this_rq,
/* 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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment