Commit | Line | Data |
---|---|---|
68a1c3f8 GC |
1 | #include <linux/init.h> |
2 | #include <linux/smp.h> | |
3 | ||
4 | #ifdef CONFIG_HOTPLUG_CPU | |
5 | ||
6 | int additional_cpus __initdata = -1; | |
7 | ||
8 | static __init int setup_additional_cpus(char *s) | |
9 | { | |
10 | return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL; | |
11 | } | |
12 | early_param("additional_cpus", setup_additional_cpus); | |
13 | ||
14 | /* | |
15 | * cpu_possible_map should be static, it cannot change as cpu's | |
16 | * are onlined, or offlined. The reason is per-cpu data-structures | |
17 | * are allocated by some modules at init time, and dont expect to | |
18 | * do this dynamically on cpu arrival/departure. | |
19 | * cpu_present_map on the other hand can change dynamically. | |
20 | * In case when cpu_hotplug is not compiled, then we resort to current | |
21 | * behaviour, which is cpu_possible == cpu_present. | |
22 | * - Ashok Raj | |
23 | * | |
24 | * Three ways to find out the number of additional hotplug CPUs: | |
25 | * - If the BIOS specified disabled CPUs in ACPI/mptables use that. | |
26 | * - The user can overwrite it with additional_cpus=NUM | |
27 | * - Otherwise don't reserve additional CPUs. | |
28 | * We do this because additional CPUs waste a lot of memory. | |
29 | * -AK | |
30 | */ | |
31 | __init void prefill_possible_map(void) | |
32 | { | |
33 | int i; | |
34 | int possible; | |
35 | ||
36 | if (additional_cpus == -1) { | |
37 | if (disabled_cpus > 0) | |
38 | additional_cpus = disabled_cpus; | |
39 | else | |
40 | additional_cpus = 0; | |
41 | } | |
42 | possible = num_processors + additional_cpus; | |
43 | if (possible > NR_CPUS) | |
44 | possible = NR_CPUS; | |
45 | ||
46 | printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", | |
47 | possible, max_t(int, possible - num_processors, 0)); | |
48 | ||
49 | for (i = 0; i < possible; i++) | |
50 | cpu_set(i, cpu_possible_map); | |
51 | } | |
52 | #endif | |
53 |