From: Peter Williams The logical value to use for the average load per task on a run queue without any runnable tasks is the "default" load for a nice==0 task. Failure to do this may lead to anomalies in try_to_wake_up(), etc. Signed-off-by: Peter Williams Cc: "Siddha, Suresh B" Cc: "Chen, Kenneth W" Cc: Ingo Molnar Cc: Nick Piggin Cc: Con Kolivas Cc: John Hawkes Signed-off-by: Andrew Morton --- kernel/sched.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff -puN kernel/sched.c~sched-smpnice-fix-average-load-per-run-queue-calculations kernel/sched.c --- devel/kernel/sched.c~sched-smpnice-fix-average-load-per-run-queue-calculations 2006-02-27 17:31:07.000000000 -0800 +++ devel-akpm/kernel/sched.c 2006-02-27 17:31:07.000000000 -0800 @@ -1066,7 +1066,7 @@ static inline unsigned long cpu_avg_load runqueue_t *rq = cpu_rq(cpu); unsigned long n = rq->nr_running; - return n ? rq->raw_weighted_load / n : rq->raw_weighted_load; + return n ? rq->raw_weighted_load / n : SCHED_LOAD_SCALE; } /* @@ -2160,6 +2160,8 @@ find_busiest_group(struct sched_domain * min(busiest_load_per_task, max_load); if (this_nr_running) this_load_per_task /= this_nr_running; + else + this_load_per_task = SCHED_LOAD_SCALE; pwr_now += this->cpu_power * min(this_load_per_task, this_load); pwr_now /= SCHED_LOAD_SCALE; _