From: Ingo Molnar The attached patch comes after sched.patch and fixes a minor aspect of affine wakeups: we did the load calculation offset by -SCHED_LOAD_SCALE, but this is incorrect since we also multiply the load value by imbalance_pct. This should only have a visible effect starting at runqueue length of 4 or so. The patch makes the balancing decision match that of the balancing timer. --- 25-akpm/kernel/sched.c | 12 +++++------- 25-akpm/kernel/sched.c.orig | 4 +--- 2 files changed, 6 insertions(+), 10 deletions(-) diff -puN kernel/sched.c~sched-affine-wakeup-fix kernel/sched.c --- 25/kernel/sched.c~sched-affine-wakeup-fix Tue Mar 30 13:03:44 2004 +++ 25-akpm/kernel/sched.c Tue Mar 30 15:44:08 2004 @@ -729,16 +729,14 @@ static int try_to_wake_up(task_t * p, un /* * Passive balance, if the load on the remote CPU is over * the limit: - */ - load = cpu_load(cpu) * 100; - /* + * * add the new task's effect to its new CPU. If sync wakeup then - * subtract current's load effect: this means that they cancel out - * each other in the sync case, the we have +1 load in the !sync case: + * subtract current's load effect: */ + load = (cpu_load(cpu) + SCHED_LOAD_SCALE) * 100; this_load = cpu_load(this_cpu); - if (!sync) - this_load += SCHED_LOAD_SCALE; + if (sync) + this_load -= SCHED_LOAD_SCALE; this_load *= rq->sd->imbalance_pct; if (load > this_load)