x86: move prefill_possible_map calling early
authorYinghai Lu <yhlu.kernel@gmail.com>
Thu, 3 Jul 2008 01:54:40 +0000 (18:54 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 8 Jul 2008 11:16:24 +0000 (13:16 +0200)
call it right after we are done with MADT/mptable handling, instead of
doing that in setup_per_cpu_areas() later on...

this way for_possible_cpu() can be used early.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/setup.c
arch/x86/kernel/setup_percpu.c
arch/x86/kernel/smpboot.c
include/asm-x86/smp.h

index f52a6fb902387d9972158c16637a16632dcf4157..cfcfbefee0b9e7ee8863f78610f9800be033fd36 100644 (file)
@@ -818,6 +818,7 @@ void __init setup_arch(char **cmdline_p)
                get_smp_config();
 #endif
 
+       prefill_possible_map();
 #ifdef CONFIG_X86_64
        init_cpu_to_node();
 #endif
index 43aca2de624a6ec06746b20b50562f6113be8cbd..5fc310f746fcdc9ca9b6aa7672ee5c5e0ce9d5ca 100644 (file)
@@ -162,16 +162,6 @@ void __init setup_per_cpu_areas(void)
        char *ptr;
        int cpu;
 
-       /* no processor from mptable or madt */
-       if (!num_processors)
-               num_processors = 1;
-
-#ifdef CONFIG_HOTPLUG_CPU
-       prefill_possible_map();
-#else
-       nr_cpu_ids = num_processors;
-#endif
-
        /* Setup cpu_pda map */
        setup_cpu_pda_map();
 
index 3b19441d78b8526142514d3cb1c81ee2eb70adb0..e1200b202ed7b3cd5d81643707b10dbfc37c5679 100644 (file)
@@ -1278,12 +1278,20 @@ __init void prefill_possible_map(void)
        int i;
        int possible;
 
+       /* no processor from mptable or madt */
+       if (!num_processors)
+               num_processors = 1;
+
+#ifdef CONFIG_HOTPLUG_CPU
        if (additional_cpus == -1) {
                if (disabled_cpus > 0)
                        additional_cpus = disabled_cpus;
                else
                        additional_cpus = 0;
        }
+#else
+       additional_cpus = 0;
+#endif
        possible = num_processors + additional_cpus;
        if (possible > NR_CPUS)
                possible = NR_CPUS;
index fad45f6a193fadeabcf83af21ffef6dee4776e5a..b324a0645a783506813776e2f61b50d0b65b7b3b 100644 (file)
@@ -119,6 +119,10 @@ static inline int num_booting_cpus(void)
 {
        return cpus_weight(cpu_callout_map);
 }
+#else
+static inline void prefill_possible_map(void)
+{
+}
 #endif /* CONFIG_SMP */
 
 extern unsigned disabled_cpus __cpuinitdata;