x86: improve UP kernel when CPU-hotplug and SMP is enabled
authorThomas Gleixner <tglx@linutronix.de>
Sun, 5 Oct 2008 14:52:24 +0000 (16:52 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 13 Oct 2008 08:33:46 +0000 (10:33 +0200)
num_possible_cpus() can be > 1 when disabled CPUs have been accounted.

Disabled CPUs are not in the cpu_present_map, so we can use
num_present_cpus() as a safe indicator to switch to UP alternatives.

Reported-by: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/alternative.c

index fb04e49776ba308b2cd8f86315bcb7692122ce80..a84ac7b570e6bb4582788da74a4c570e28fd65e9 100644 (file)
@@ -444,7 +444,7 @@ void __init alternative_instructions(void)
                                            _text, _etext);
 
                /* Only switch to UP mode if we don't immediately boot others */
-               if (num_possible_cpus() == 1 || setup_max_cpus <= 1)
+               if (num_present_cpus() == 1 || setup_max_cpus <= 1)
                        alternatives_smp_switch(0);
        }
 #endif