Commit a5d77afe authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Handle NR_CPUS overflow

From: john stultz <johnstul@us.ibm.com>

Don't try to support more than NR_CPUS cpus: things overflow.

Also, increase the default in config for some architectures.  (Dave
Hansen).
parent 4f2a733a
...@@ -454,6 +454,7 @@ config SMP ...@@ -454,6 +454,7 @@ config SMP
config NR_CPUS config NR_CPUS
int "Maximum number of CPUs (2-255)" int "Maximum number of CPUs (2-255)"
depends on SMP depends on SMP
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
default "8" default "8"
help help
This allows you to specify the maximum number of CPUs which this This allows you to specify the maximum number of CPUs which this
......
...@@ -167,6 +167,11 @@ void __init MP_processor_info (struct mpc_config_processor *m) ...@@ -167,6 +167,11 @@ void __init MP_processor_info (struct mpc_config_processor *m)
boot_cpu_logical_apicid = apicid; boot_cpu_logical_apicid = apicid;
} }
if (num_processors >= NR_CPUS) {
printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot "
"boot CPU(apicid 0x%d).\n", NR_CPUS, m->mpc_apicid);
return;
}
num_processors++; num_processors++;
if (MAX_APICS - m->mpc_apicid <= 0) { if (MAX_APICS - m->mpc_apicid <= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment