From c2b40b77f39525efc449c36950c32df453762ee9 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:59 -0800 Subject: [PATCH] --- yaml --- r: 13463 b: refs/heads/master c: 6dd4a85bb3ee0715415892c8b0f2a9bd08d31ca4 h: refs/heads/master i: 13461: cfd776ba0a5eab338cc8571d5d76b867950d1af8 13459: 8881525d27635e48d07f2a65bbbccbcdde6ae064 13455: 3026940b6e9a53d0ad8970442038acfb832c12fd v: v3 --- [refs] | 2 +- trunk/kernel/sched.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 270fc70ef43c..f6ffad19a792 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3b0bd9bc6f3b8a47853d1b1de4520de3878e8941 +refs/heads/master: 6dd4a85bb3ee0715415892c8b0f2a9bd08d31ca4 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index ec9ea9119b98..502d47c883b6 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -972,15 +972,16 @@ void kick_process(task_t *p) static inline unsigned long __source_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); + unsigned long running = rq->nr_running; unsigned long source_load, cpu_load = rq->cpu_load[type-1], - load_now = rq->nr_running * SCHED_LOAD_SCALE; + load_now = running * SCHED_LOAD_SCALE; if (type == 0) source_load = load_now; else source_load = min(cpu_load, load_now); - if (idle == NOT_IDLE || rq->nr_running > 1) + if (running > 1 || (idle == NOT_IDLE && running)) /* * If we are busy rebalancing the load is biased by * priority to create 'nice' support across cpus. When @@ -989,7 +990,7 @@ static inline unsigned long __source_load(int cpu, int type, enum idle_type idle * prevent idle rebalance from trying to pull tasks from a * queue with only one running task. */ - source_load *= rq->prio_bias; + source_load = source_load * rq->prio_bias / running; return source_load; } @@ -1005,16 +1006,17 @@ static inline unsigned long source_load(int cpu, int type) static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); + unsigned long running = rq->nr_running; unsigned long target_load, cpu_load = rq->cpu_load[type-1], - load_now = rq->nr_running * SCHED_LOAD_SCALE; + load_now = running * SCHED_LOAD_SCALE; if (type == 0) target_load = load_now; else target_load = max(cpu_load, load_now); - if (idle == NOT_IDLE || rq->nr_running > 1) - target_load *= rq->prio_bias; + if (running > 1 || (idle == NOT_IDLE && running)) + target_load = target_load * rq->prio_bias / running; return target_load; }