2 CPUs, but only one is used

Nathan Lynch ntl at pobox.com
Mon Dec 25 16:52:51 EST 2006


Giuliano Pochini wrote:
> I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and
> then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is
> put online without errors, but it stays idle+wait=100% and of course
> user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

...

> At the end of kernel/cpu.c::cpu_up() both cpus are set as present, possible
> and online. The problem is that in kernel/sched.c::find_idlest_group()
> p->cpus_allowed is always 1 (it should be 3). I tried to put a dump_stack()
> or a printk(mask) in set_cpu_mask() but it crashes badly when mask is not 3,
> ie. anything different from khelper or kthread, so I couldn't know what sets
> the wrong cpumask.

Does this fix it?

diff --git a/kernel/sched.c b/kernel/sched.c
index b515e3c..3c8b1c5 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6875,7 +6875,7 @@ void __init sched_init_smp(void)
 
 	lock_cpu_hotplug();
 	arch_init_sched_domains(&cpu_online_map);
-	cpus_andnot(non_isolated_cpus, cpu_online_map, cpu_isolated_map);
+	cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);
 	if (cpus_empty(non_isolated_cpus))
 		cpu_set(smp_processor_id(), non_isolated_cpus);
 	unlock_cpu_hotplug();



More information about the Linuxppc-dev mailing list