diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/init/main.c b/init/main.c index 99ce94930b09..833a67df1f7e 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -359,10 +359,31 @@ static void __init smp_init(void) | |||
359 | #endif | 359 | #endif |
360 | 360 | ||
361 | static inline void setup_per_cpu_areas(void) { } | 361 | static inline void setup_per_cpu_areas(void) { } |
362 | static inline void setup_nr_cpu_ids(void) { } | ||
362 | static inline void smp_prepare_cpus(unsigned int maxcpus) { } | 363 | static inline void smp_prepare_cpus(unsigned int maxcpus) { } |
363 | 364 | ||
364 | #else | 365 | #else |
365 | 366 | ||
367 | #if NR_CPUS > BITS_PER_LONG | ||
368 | cpumask_t cpu_mask_all __read_mostly = CPU_MASK_ALL; | ||
369 | EXPORT_SYMBOL(cpu_mask_all); | ||
370 | #endif | ||
371 | |||
372 | /* Setup number of possible processor ids */ | ||
373 | int nr_cpu_ids __read_mostly = NR_CPUS; | ||
374 | EXPORT_SYMBOL(nr_cpu_ids); | ||
375 | |||
376 | /* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */ | ||
377 | static void __init setup_nr_cpu_ids(void) | ||
378 | { | ||
379 | int cpu, highest_cpu = 0; | ||
380 | |||
381 | for_each_possible_cpu(cpu) | ||
382 | highest_cpu = cpu; | ||
383 | |||
384 | nr_cpu_ids = highest_cpu + 1; | ||
385 | } | ||
386 | |||
366 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA | 387 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA |
367 | unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; | 388 | unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; |
368 | 389 | ||
@@ -537,6 +558,7 @@ asmlinkage void __init start_kernel(void) | |||
537 | setup_command_line(command_line); | 558 | setup_command_line(command_line); |
538 | unwind_setup(); | 559 | unwind_setup(); |
539 | setup_per_cpu_areas(); | 560 | setup_per_cpu_areas(); |
561 | setup_nr_cpu_ids(); | ||
540 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ | 562 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ |
541 | 563 | ||
542 | /* | 564 | /* |
@@ -811,7 +833,7 @@ static int __init kernel_init(void * unused) | |||
811 | /* | 833 | /* |
812 | * init can run on any cpu. | 834 | * init can run on any cpu. |
813 | */ | 835 | */ |
814 | set_cpus_allowed(current, CPU_MASK_ALL); | 836 | set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR); |
815 | /* | 837 | /* |
816 | * Tell the world that we're going to be the grim | 838 | * Tell the world that we're going to be the grim |
817 | * reaper of innocent orphaned children. | 839 | * reaper of innocent orphaned children. |