From: Nick Piggin <nickpiggin@yahoo.com.au>

After the for_each_domain change, the warn here won't trigger, instead it
will oops in the if statement.  Also, make sure we don't pass an empty
cpumask to for_each_cpu.


---

 25-akpm/kernel/sched.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff -puN kernel/sched.c~sched-fix-activelb kernel/sched.c
--- 25/kernel/sched.c~sched-fix-activelb	2004-03-28 23:56:14.912282096 -0800
+++ 25-akpm/kernel/sched.c	2004-03-28 23:56:14.916281488 -0800
@@ -1684,8 +1684,7 @@ static void active_load_balance(runqueue
 		if (cpu_isset(busiest->push_cpu, sd->span))
 			break;
 	}
-
-	if (!sd->parent && !cpu_isset(busiest->push_cpu, sd->span)) {
+	if (!sd) {
 		WARN_ON(1);
 		return;
 	}
@@ -1699,20 +1698,20 @@ static void active_load_balance(runqueue
  	do {
 		cpumask_t tmp;
 		runqueue_t *rq;
- 		int push_cpu = 0, nr = 0;
+ 		int push_cpu = 0;
 
  		if (group == busy_group)
  			goto next_group;
 
 		cpus_and(tmp, group->cpumask, cpu_online_map);
+		if (cpus_weight(tmp) == 0)
+			goto next_group;
+
  		for_each_cpu_mask(i, tmp) {
 			if (!idle_cpu(i))
 				goto next_group;
  			push_cpu = i;
- 			nr++;
  		}
- 		if (nr == 0)
- 			goto next_group;
 
 		rq = cpu_rq(push_cpu);
 		double_lock_balance(busiest, rq);

_