[PATCH] sched: active_load_balance fixes
commit94fe0f3e16f50895127b8e72190cf014ce54a9ff
authorDarren Hart <dvhltc@us.ibm.com>
Mon, 25 Oct 2004 11:11:09 +0000 (25 04:11 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 25 Oct 2004 11:11:09 +0000 (25 04:11 -0700)
tree9a727cbfac6e130714915a499e7d2faae7c5e7ef
parent7e0638185bc9233dfdb2633b63cc6fd2836ddfb4
[PATCH] sched: active_load_balance fixes

The following patch against the latest mm fixes several problems with
active_load_balance().

Rather than starting with the highest allowable domain (SD_LOAD_BALANCE is
still set) and depending on the order of the cpu groups, we start at the
lowest domain and work up until we find a suitable CPU or run out of
options (SD_LOAD_BALANCE is no longer set).  This is a more robust approach
as it is more explicit and not subject to the construction order of the cpu
groups.

We move the test for busiest_rq->nr_running <=1 into the domain loop so we
don't continue to try and move tasks when there are none left to move.
This new logic (testing for nr_running in the domain loop) should make the
busiest_rq==target_rq condition really impossible, so we have replaced the
graceful continue on fail with a BUG_ON.  (Bjorn Helgaas, please confirm)

We eliminate the exclusion of the busiest_cpu's group from the pool of
available groups to push to as it is the ideal group to push to, even if
not very likely to be available.  Note that by removing the test for
group==busy_group and allowing it to also be tested for suitability, the
running time is nearly the same.

We no longer force the destination CPU to be in a group of completely idle
CPUs, nor to be the last in that group.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c