From bea304dc23e20dd15295e83edc28ba938f1b190d Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 12 Feb 2007 00:53:51 -0800 Subject: [PATCH] --- yaml --- r: 47997 b: refs/heads/master c: ff91691bccdb741efb2df0489058a4961fa79598 h: refs/heads/master i: 47995: cb8ebfe1c4a99165b01ec5b6f5b0062f4fb1543a v: v3 --- [refs] | 2 +- trunk/kernel/sched.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 82248d8fb913..79c2941d1f61 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0a9ac38246b11892ad20a1eb9deb67adf8c0db2f +refs/heads/master: ff91691bccdb741efb2df0489058a4961fa79598 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 1fd67e16cd31..08f86178aa34 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -2897,14 +2897,16 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu) static void update_load(struct rq *this_rq) { unsigned long this_load; - int i, scale; + unsigned int i, scale; this_load = this_rq->raw_weighted_load; /* Update our load: */ - for (i = 0, scale = 1; i < 3; i++, scale <<= 1) { + for (i = 0, scale = 1; i < 3; i++, scale += scale) { unsigned long old_load, new_load; + /* scale is effectively 1 << i now, and >> i divides by scale */ + old_load = this_rq->cpu_load[i]; new_load = this_load; /* @@ -2914,7 +2916,7 @@ static void update_load(struct rq *this_rq) */ if (new_load > old_load) new_load += scale-1; - this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) / scale; + this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i; } }