aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-07-16 02:41:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:47 -0400
commit8b3b295502444340dd0701855ac422fbf32e161d (patch)
tree949accf30a7b8bf6a0ccd074a5a4b9f6115c1f7b
parent98c0d07cbf2a8582a0341b05ad564247e608f6f9 (diff)
adjust nosmp handling
Especially when !CONFIG_HOTPLUG_CPU, avoid needlessy allocating resources for CPUs that can never become available. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--init/main.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/init/main.c b/init/main.c
index c8c9a0b21e99..d3bcb3b11620 100644
--- a/init/main.c
+++ b/init/main.c
@@ -132,20 +132,9 @@ static char *static_command_line;
132static char *execute_command; 132static char *execute_command;
133static char *ramdisk_execute_command; 133static char *ramdisk_execute_command;
134 134
135#ifdef CONFIG_SMP
135/* Setup configured maximum number of CPUs to activate */ 136/* Setup configured maximum number of CPUs to activate */
136static unsigned int max_cpus = NR_CPUS; 137static unsigned int __initdata max_cpus = NR_CPUS;
137
138/*
139 * If set, this is an indication to the drivers that reset the underlying
140 * device before going ahead with the initialization otherwise driver might
141 * rely on the BIOS and skip the reset operation.
142 *
143 * This is useful if kernel is booting in an unreliable environment.
144 * For ex. kdump situaiton where previous kernel has crashed, BIOS has been
145 * skipped and devices will be in unknown state.
146 */
147unsigned int reset_devices;
148EXPORT_SYMBOL(reset_devices);
149 138
150/* 139/*
151 * Setup routine for controlling SMP activation 140 * Setup routine for controlling SMP activation
@@ -160,10 +149,10 @@ EXPORT_SYMBOL(reset_devices);
160static int __init nosmp(char *str) 149static int __init nosmp(char *str)
161{ 150{
162 max_cpus = 0; 151 max_cpus = 0;
163 return 1; 152 return 0;
164} 153}
165 154
166__setup("nosmp", nosmp); 155early_param("nosmp", nosmp);
167 156
168static int __init maxcpus(char *str) 157static int __init maxcpus(char *str)
169{ 158{
@@ -172,6 +161,21 @@ static int __init maxcpus(char *str)
172} 161}
173 162
174__setup("maxcpus=", maxcpus); 163__setup("maxcpus=", maxcpus);
164#else
165#define max_cpus NR_CPUS
166#endif
167
168/*
169 * If set, this is an indication to the drivers that reset the underlying
170 * device before going ahead with the initialization otherwise driver might
171 * rely on the BIOS and skip the reset operation.
172 *
173 * This is useful if kernel is booting in an unreliable environment.
174 * For ex. kdump situaiton where previous kernel has crashed, BIOS has been
175 * skipped and devices will be in unknown state.
176 */
177unsigned int reset_devices;
178EXPORT_SYMBOL(reset_devices);
175 179
176static int __init set_reset_devices(char *str) 180static int __init set_reset_devices(char *str)
177{ 181{
@@ -385,6 +389,10 @@ static void __init smp_init(void)
385{ 389{
386 unsigned int cpu; 390 unsigned int cpu;
387 391
392#ifndef CONFIG_HOTPLUG_CPU
393 cpu_possible_map = cpu_present_map;
394#endif
395
388 /* FIXME: This should be done in userspace --RR */ 396 /* FIXME: This should be done in userspace --RR */
389 for_each_present_cpu(cpu) { 397 for_each_present_cpu(cpu) {
390 if (num_online_cpus() >= max_cpus) 398 if (num_online_cpus() >= max_cpus)
@@ -529,6 +537,10 @@ asmlinkage void __init start_kernel(void)
529 setup_arch(&command_line); 537 setup_arch(&command_line);
530 setup_command_line(command_line); 538 setup_command_line(command_line);
531 unwind_setup(); 539 unwind_setup();
540#ifndef CONFIG_HOTPLUG_CPU
541 if (max_cpus < 2)
542 cpu_possible_map = cpu_online_map;
543#endif
532 setup_per_cpu_areas(); 544 setup_per_cpu_areas();
533 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 545 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
534 546