<div>Hi,</div><div><br></div><div>I didn't actually try to compile the patch below; it didn't look like C code so I wasn't sure what compiler to run it through. I guess maybe its python? However, I'm very sure that the patches are completely correct, because I read them, and I also know that Paul is a trustworthy programmer. Thus, please add my ack</div>
<div><br></div>Ack'ed by: Linas Vepstas <<a href="mailto:linasvepstas@gmail.com">linasvepstas@gmail.com</a>><br><br><br><div class="gmail_quote">On 31 March 2012 11:33, Paul E. McKenney <span dir="ltr"><<a href="mailto:paulmck@linux.vnet.ibm.com">paulmck@linux.vnet.ibm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Although there have been numerous complaints about the complexity of<br>
parallel programming (especially over the past 5-10 years), the plain<br>
truth is that the incremental complexity of parallel programming over<br>
that of sequential programming is not as large as is commonly believed.<br>
Despite that you might have heard, the mind-numbing complexity of modern<br>
computer systems is not due so much to there being multiple CPUs, but<br>
rather to there being any CPUs at all. In short, for the ultimate in<br>
computer-system simplicity, the optimal choice is NR_CPUS=0.<br>
<br>
This commit therefore limits kernel builds to zero CPUs. This change<br>
has the beneficial side effect of rendering all kernel bugs harmless.<br>
Furthermore, this commit enables additional beneficial changes, for<br>
example, the removal of those parts of the kernel that are not needed<br>
when there are zero CPUs.<br>
<br>
Signed-off-by: Paul E. McKenney <<a href="mailto:paulmck@linux.vnet.ibm.com">paulmck@linux.vnet.ibm.com</a>><br>
Reviewed-by: Thomas Gleixner <<a href="mailto:tglx@linutronix.de">tglx@linutronix.de</a>><br>
---<br>
<br>
alpha/Kconfig | 11 ++++++-----<br>
arm/Kconfig | 6 +++---<br>
blackfin/Kconfig | 3 ++-<br>
hexagon/Kconfig | 9 +++++----<br>
ia64/Kconfig | 9 +++++----<br>
m32r/Kconfig | 10 ++++++----<br>
mips/Kconfig | 21 +++++++++++----------<br>
mn10300/Kconfig | 3 ++-<br>
parisc/Kconfig | 6 +++---<br>
powerpc/platforms/Kconfig.cputype | 8 ++++----<br>
s390/Kconfig | 12 +++++++-----<br>
sh/Kconfig | 11 ++++++-----<br>
sparc/Kconfig | 8 ++++----<br>
tile/Kconfig | 9 +++++----<br>
x86/Kconfig | 16 +++++++++-------<br>
15 files changed, 78 insertions(+), 64 deletions(-)<br>
<br>
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig<br>
index 56a4df9..1766b4a 100644<br>
--- a/arch/alpha/Kconfig<br>
+++ b/arch/alpha/Kconfig<br>
@@ -541,14 +541,15 @@ config HAVE_DEC_LOCK<br>
default y<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-32)"<br>
- range 2 32<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "32" if ALPHA_GENERIC || ALPHA_MARVEL<br>
- default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL<br>
+ default "0" if ALPHA_GENERIC || ALPHA_MARVEL<br>
+ default "0" if !ALPHA_GENERIC && !ALPHA_MARVEL<br>
help<br>
MARVEL support can handle a maximum of 32 CPUs, all the others<br>
- with working support have a maximum of 4 CPUs.<br>
+ with working support have a maximum of 4 CPUs. But why take<br>
+ chances? Just stick with zero CPUs.<br>
<br>
config ARCH_DISCONTIGMEM_ENABLE<br>
bool "Discontiguous Memory Support (EXPERIMENTAL)"<br>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig<br>
index a48aecc..1f07a3a 100644<br>
--- a/arch/arm/Kconfig<br>
+++ b/arch/arm/Kconfig<br>
@@ -1551,10 +1551,10 @@ config PAGE_OFFSET<br>
default 0xC0000000<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-32)"<br>
- range 2 32<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "4"<br>
+ default "0"<br>
<br>
config HOTPLUG_CPU<br>
bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"<br>
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig<br>
index abe5a9e..6a78549 100644<br>
--- a/arch/blackfin/Kconfig<br>
+++ b/arch/blackfin/Kconfig<br>
@@ -241,7 +241,8 @@ config SMP<br>
config NR_CPUS<br>
int<br>
depends on SMP<br>
- default 2 if BF561<br>
+ range 0 0<br>
+ default 0 if BF561<br>
<br>
config HOTPLUG_CPU<br>
bool "Support for hot-pluggable CPUs"<br>
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig<br>
index 9059e39..daab009 100644<br>
--- a/arch/hexagon/Kconfig<br>
+++ b/arch/hexagon/Kconfig<br>
@@ -158,13 +158,14 @@ config SMP<br>
<br>
config NR_CPUS<br>
int "Maximum number of CPUs" if SMP<br>
- range 2 6 if SMP<br>
- default "1" if !SMP<br>
- default "6" if SMP<br>
+ range 0 0 if SMP<br>
+ default "0" if !SMP<br>
+ default "0" if SMP<br>
---help---<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 6 and the<br>
- minimum value which makes sense is 2.<br>
+ minimum value which makes sense is 2. But a limit of zero is<br>
+ so much safer!<br>
<br>
This is purely to save memory - each supported CPU adds<br>
approximately eight kilobytes to the kernel image.<br>
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig<br>
index bd72669..fea0e6d 100644<br>
--- a/arch/ia64/Kconfig<br>
+++ b/arch/ia64/Kconfig<br>
@@ -373,16 +373,17 @@ config SMP<br>
If you don't know what to do here, say N.<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-4096)"<br>
- range 2 4096<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "4096"<br>
+ default "0"<br>
help<br>
You should set this to the number of CPUs in your system, but<br>
keep in mind that a kernel compiled for, e.g., 2 CPUs will boot but<br>
only use 2 CPUs on a >2 CPU system. Setting this to a value larger<br>
than 64 will cause the use of a CPU mask array, causing a small<br>
- performance hit.<br>
+ performance hit. And setting it larger than zero risks all<br>
+ manner of software bugs, so we just play it safe.<br>
<br>
config HOTPLUG_CPU<br>
bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"<br>
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig<br>
index ef80a65..68b9e88 100644<br>
--- a/arch/m32r/Kconfig<br>
+++ b/arch/m32r/Kconfig<br>
@@ -300,14 +300,16 @@ config CHIP_M32700_TS1<br>
default n<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-32)"<br>
- range 2 32<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "2"<br>
+ default "0"<br>
help<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 32 and the<br>
- minimum value which makes sense is 2.<br>
+ minimum value which makes sense is 2. Zero may not make sense,<br>
+ but given that there is much in this world that does not make<br>
+ sense, zero it is!<br>
<br>
This is purely to save memory - each supported CPU adds<br>
approximately eight kilobytes to the kernel image.<br>
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig<br>
index 5ab6e89..3d7d06c 100644<br>
--- a/arch/mips/Kconfig<br>
+++ b/arch/mips/Kconfig<br>
@@ -2192,16 +2192,16 @@ config NR_CPUS_DEFAULT_64<br>
bool<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-64)"<br>
- range 1 64 if NR_CPUS_DEFAULT_1<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0 if NR_CPUS_DEFAULT_1<br>
depends on SMP<br>
- default "1" if NR_CPUS_DEFAULT_1<br>
- default "2" if NR_CPUS_DEFAULT_2<br>
- default "4" if NR_CPUS_DEFAULT_4<br>
- default "8" if NR_CPUS_DEFAULT_8<br>
- default "16" if NR_CPUS_DEFAULT_16<br>
- default "32" if NR_CPUS_DEFAULT_32<br>
- default "64" if NR_CPUS_DEFAULT_64<br>
+ default "0" if NR_CPUS_DEFAULT_1<br>
+ default "0" if NR_CPUS_DEFAULT_2<br>
+ default "0" if NR_CPUS_DEFAULT_4<br>
+ default "0" if NR_CPUS_DEFAULT_8<br>
+ default "0" if NR_CPUS_DEFAULT_16<br>
+ default "0" if NR_CPUS_DEFAULT_32<br>
+ default "0" if NR_CPUS_DEFAULT_64<br>
help<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 32 for 32-bit<br>
@@ -2212,7 +2212,8 @@ config NR_CPUS<br>
This is purely to save memory - each supported CPU adds<br>
approximately eight kilobytes to the kernel image. For best<br>
performance should round up your number of processors to the next<br>
- power of two.<br>
+ power of two. And just think how much more memory we will<br>
+ save by setting the limit to zero!<br>
<br>
source "kernel/time/Kconfig"<br>
<br>
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig<br>
index 8f1c40d..85fc112 100644<br>
--- a/arch/mn10300/Kconfig<br>
+++ b/arch/mn10300/Kconfig<br>
@@ -201,7 +201,8 @@ config SMP<br>
config NR_CPUS<br>
int<br>
depends on SMP<br>
- default "2"<br>
+ range 0 0<br>
+ default "0"<br>
<br>
source "kernel/Kconfig.preempt"<br>
<br>
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig<br>
index 242a1b7..358eaf8 100644<br>
--- a/arch/parisc/Kconfig<br>
+++ b/arch/parisc/Kconfig<br>
@@ -254,10 +254,10 @@ config HPUX<br>
depends on !64BIT<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-32)"<br>
- range 2 32<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "32"<br>
+ default "0"<br>
<br>
endmenu<br>
<br>
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype<br>
index 425db18..5e607e0 100644<br>
--- a/arch/powerpc/platforms/Kconfig.cputype<br>
+++ b/arch/powerpc/platforms/Kconfig.cputype<br>
@@ -356,11 +356,11 @@ config SMP<br>
If you don't know what to do here, say N.<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-8192)"<br>
- range 2 8192<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "32" if PPC64<br>
- default "4"<br>
+ default "0" if PPC64<br>
+ default "0"<br>
<br>
config NOT_COHERENT_CACHE<br>
bool<br>
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig<br>
index d172758..f9bc067 100644<br>
--- a/arch/s390/Kconfig<br>
+++ b/arch/s390/Kconfig<br>
@@ -169,15 +169,17 @@ config SMP<br>
Even if you don't know what to do here, say Y.<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-64)"<br>
- range 2 64<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "32" if !64BIT<br>
- default "64" if 64BIT<br>
+ default "0" if !64BIT<br>
+ default "0" if 64BIT<br>
help<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 64 and the<br>
- minimum value which makes sense is 2.<br>
+ minimum value which makes sense is 2. The minimal value that<br>
+ makes sense might well be 2, but we all know that the only<br>
+ -sane- value is zero!<br>
<br>
This is purely to save memory - each supported CPU adds<br>
approximately sixteen kilobytes to the kernel image.<br>
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig<br>
index 713fb58..5ddc7c0 100644<br>
--- a/arch/sh/Kconfig<br>
+++ b/arch/sh/Kconfig<br>
@@ -705,18 +705,19 @@ config SMP<br>
If you don't know what to do here, say N.<br>
<br>
config NR_CPUS<br>
- int "Maximum number of CPUs (2-32)"<br>
- range 2 32<br>
+ int "Maximum number of CPUs (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "4" if CPU_SUBTYPE_SHX3<br>
- default "2"<br>
+ default "0" if CPU_SUBTYPE_SHX3<br>
+ default "0"<br>
help<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 32 and the<br>
minimum value which makes sense is 2.<br>
<br>
This is purely to save memory - each supported CPU adds<br>
- approximately eight kilobytes to the kernel image.<br>
+ approximately eight kilobytes to the kernel image. Debloating<br>
+ is the way, NR_CPUS to zero today!!!<br>
<br>
config HOTPLUG_CPU<br>
bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"<br>
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig<br>
index ca5580e..0de9f0f 100644<br>
--- a/arch/sparc/Kconfig<br>
+++ b/arch/sparc/Kconfig<br>
@@ -177,10 +177,10 @@ config SMP<br>
config NR_CPUS<br>
int "Maximum number of CPUs"<br>
depends on SMP<br>
- range 2 32 if SPARC32<br>
- range 2 1024 if SPARC64<br>
- default 32 if SPARC32<br>
- default 64 if SPARC64<br>
+ range 0 0 if SPARC32<br>
+ range 0 0 if SPARC64<br>
+ default 0 if SPARC32<br>
+ default 0 if SPARC64<br>
<br>
source kernel/Kconfig.hz<br>
<br>
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig<br>
index 11270ca..a05112c 100644<br>
--- a/arch/tile/Kconfig<br>
+++ b/arch/tile/Kconfig<br>
@@ -126,14 +126,15 @@ source "init/Kconfig"<br>
menu "Tilera-specific configuration"<br>
<br>
config NR_CPUS<br>
- int "Maximum number of tiles (2-255)"<br>
- range 2 255<br>
+ int "Maximum number of tiles (0-0)"<br>
+ range 0 0<br>
depends on SMP<br>
- default "64"<br>
+ default "0"<br>
---help---<br>
Building with 64 is the recommended value, but a slightly<br>
smaller kernel memory footprint results from using a smaller<br>
- value on chips with fewer tiles.<br>
+ value on chips with fewer tiles. To minimize both memory<br>
+ footprint and bugs, use zero and only zero.<br>
<br>
source "kernel/time/Kconfig"<br>
<br>
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig<br>
index 5bed94e..a6977f2 100644<br>
--- a/arch/x86/Kconfig<br>
+++ b/arch/x86/Kconfig<br>
@@ -773,19 +773,21 @@ config MAXSMP<br>
<br>
config NR_CPUS<br>
int "Maximum number of CPUs" if SMP && !MAXSMP<br>
- range 2 8 if SMP && X86_32 && !X86_BIGSMP<br>
- range 2 512 if SMP && !MAXSMP<br>
- default "1" if !SMP<br>
- default "4096" if MAXSMP<br>
- default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)<br>
- default "8" if SMP<br>
+ range 0 0 if SMP && X86_32 && !X86_BIGSMP<br>
+ range 0 0 if SMP && !MAXSMP<br>
+ default "0" if !SMP<br>
+ default "0" if MAXSMP<br>
+ default "0" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)<br>
+ default "0" if SMP<br>
---help---<br>
This allows you to specify the maximum number of CPUs which this<br>
kernel will support. The maximum supported value is 512 and the<br>
minimum value which makes sense is 2.<br>
<br>
This is purely to save memory - each supported CPU adds<br>
- approximately eight kilobytes to the kernel image.<br>
+ approximately eight kilobytes to the kernel image. But<br>
+ the first supported CPU brings a lot of bugs with it, so<br>
+ for ultimate reliability, set the number of CPUs to zero.<br>
<br>
config SCHED_SMT<br>
bool "SMT (Hyperthreading) scheduler support"<br>
<br>
--<br>
To unsubscribe from this list: send the line "unsubscribe linux-hexagon" in<br>
the body of a message to <a href="mailto:majordomo@vger.kernel.org">majordomo@vger.kernel.org</a><br>
More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html" target="_blank">http://vger.kernel.org/majordomo-info.html</a><br>
</blockquote></div><br>