diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.40-vanilla/kernel/sched.c linux-2.5.40-sched_cleanup/kernel/sched.c --- linux-2.5.40-vanilla/kernel/sched.c Tue Oct 1 00:07:35 2002 +++ linux-2.5.40-sched_cleanup/kernel/sched.c Thu Oct 3 14:09:31 2002 @@ -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 <= (max_load + 3)/4)) { busiest = NULL; goto out; } @@ -746,6 +746,11 @@ task_t *tmp; busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance); + /* + * 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; if (!busiest) goto out;