--- linux-2.5/kernel/sched.c.old 2002-10-02 23:14:12.000000000 +1000 +++ linux-2.5/kernel/sched.c 2002-10-03 10:03:41.000000000 +1000 @@ -689,10 +689,10 @@ if (likely(!busiest)) goto out; - *imbalance = (max_load - nr_running) / 2; + *imbalance = max_load - nr_running; /* It needs an at least ~25% imbalance to trigger balancing. */ - if (!idle && (*imbalance < (max_load + 3)/4)) { + if (!idle && (*imbalance*4 < max_load)) { busiest = NULL; goto out; } @@ -702,10 +702,11 @@ * Make sure nothing changed since we checked the * runqueue length. */ - if (busiest->nr_running <= nr_running + 1) { + if (busiest->nr_running <= nr_running) { spin_unlock(&busiest->lock); busiest = NULL; } + out: return busiest; } @@ -748,7 +749,12 @@ busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance); if (!busiest) goto out; - + /* + * We only want to steal a number of tasks equal to 1/2 the imbalance, + * otherwise, we'll just shift the imbalance to the new queue. + */ + imbalance /= 2; + /* * We first consider expired tasks. Those will likely not be * executed in the near future, and they are most likely to