LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>, Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <andi@firstfloor.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	davej@codemonkey.org.uk, David Miller <davem@davemloft.net>,
	Eric Dumazet <dada1@cosmosbay.com>,
	Jack Steiner <steiner@sgi.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>, Jes Sorensen <jes@sgi.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	peterz@infradead.org, Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	IA64 <linux-ia64@vger.kernel.org>,
	PowerPC <linuxppc-dev@ozlabs.org>,
	S390 <linux-s390@vger.kernel.org>,
	SPARC <sparclinux@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 12/35] cpumask: make CONFIG_NR_CPUS always valid.
Date: Mon, 20 Oct 2008 10:03:31 -0700	[thread overview]
Message-ID: <20081020170321.260062000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20081020170319.539427000@polaris-admin.engr.sgi.com>

[-- Attachment #1: cpumask:CONFIG_NR_CPUS-always.patch --]
[-- Type: text/plain, Size: 7400 bytes --]

Currently we have NR_CPUS, which is 1 on UP, and CONFIG_NR_CPUS on
SMP.  If we make CONFIG_NR_CPUS always valid (and always 1 on !SMP),
we can skip the middleman.

This also allows us to find and check all the remaining NR_CPUS users.

From: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/alpha/Kconfig      |   10 +++++-----
 arch/arm/Kconfig        |    6 +++---
 arch/ia64/Kconfig       |    8 ++++----
 arch/m32r/Kconfig       |    8 ++++----
 arch/mips/Kconfig       |    4 ++--
 arch/parisc/Kconfig     |    8 ++++----
 arch/s390/Kconfig       |   10 +++++-----
 arch/sh/Kconfig         |   10 +++++-----
 arch/sparc/Kconfig      |    8 ++++----
 arch/sparc64/Kconfig    |    8 ++++----
 arch/um/Kconfig         |    8 ++++----
 arch/x86/Kconfig        |   11 +++++------
 include/linux/threads.h |   10 ++--------
 13 files changed, 51 insertions(+), 58 deletions(-)

--- test-compile.orig/arch/alpha/Kconfig
+++ test-compile/arch/alpha/Kconfig
@@ -543,11 +543,11 @@ config HAVE_DEC_LOCK
 	default y
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32" if ALPHA_GENERIC || ALPHA_MARVEL
-	default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP && (ALPHA_GENERIC || ALPHA_MARVEL)
+	default "4" if SMP && (!ALPHA_GENERIC && !ALPHA_MARVEL)
 	help
 	  MARVEL support can handle a maximum of 32 CPUs, all the others
           with working support have a maximum of 4 CPUs.
--- test-compile.orig/arch/arm/Kconfig
+++ test-compile/arch/arm/Kconfig
@@ -767,9 +767,9 @@ config PAGE_OFFSET
 	default 0xC0000000
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
 	default "4"
 
 config HOTPLUG_CPU
--- test-compile.orig/arch/ia64/Kconfig
+++ test-compile/arch/ia64/Kconfig
@@ -313,10 +313,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-4096)"
-	range 2 4096
-	depends on SMP
-	default "4096"
+	int "Maximum number of CPUs (2-4096)" if SMP
+	range 2 4096 if SMP
+	default "1" if !SMP
+	default "4096" if SMP
 	help
 	  You should set this to the number of CPUs in your system, but
 	  keep in mind that a kernel compiled for, e.g., 2 CPUs will boot but
--- test-compile.orig/arch/m32r/Kconfig
+++ test-compile/arch/m32r/Kconfig
@@ -316,10 +316,10 @@ config CHIP_M32700_TS1
 	default n
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "2"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "2" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 32 and the
--- test-compile.orig/arch/mips/Kconfig
+++ test-compile/arch/mips/Kconfig
@@ -1719,9 +1719,9 @@ config NR_CPUS_DEFAULT_64
 	bool
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-64)"
+	int "Maximum number of CPUs (2-64)" if SMP
 	range 1 64 if NR_CPUS_DEFAULT_1
-	depends on SMP
+	default "1" if !SMP
 	default "1" if NR_CPUS_DEFAULT_1
 	default "2" if NR_CPUS_DEFAULT_2
 	default "4" if NR_CPUS_DEFAULT_4
--- test-compile.orig/arch/parisc/Kconfig
+++ test-compile/arch/parisc/Kconfig
@@ -251,10 +251,10 @@ config HPUX
 	depends on !64BIT
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP
 
 endmenu
 
--- test-compile.orig/arch/s390/Kconfig
+++ test-compile/arch/s390/Kconfig
@@ -113,11 +113,11 @@ config SMP
 	  Even if you don't know what to do here, say Y.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-64)"
-	range 2 64
-	depends on SMP
-	default "32" if !64BIT
-	default "64" if 64BIT
+	int "Maximum number of CPUs (2-64)" if SMP
+	range 2 64 if SMP
+	default "1" if !SMP
+	default "32" if SMP && !64BIT
+	default "64" if SMP && 64BIT
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 64 and the
--- test-compile.orig/arch/sh/Kconfig
+++ test-compile/arch/sh/Kconfig
@@ -528,11 +528,11 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "4" if CPU_SHX3
-	default "2"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "4" if SMP && CPU_SHX3
+	default "2" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 32 and the
--- test-compile.orig/arch/sparc/Kconfig
+++ test-compile/arch/sparc/Kconfig
@@ -62,10 +62,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if SMP
+	default "32" if SMP
 
 config SPARC
 	bool
--- test-compile.orig/arch/sparc64/Kconfig
+++ test-compile/arch/sparc64/Kconfig
@@ -168,10 +168,10 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-1024)"
-	range 2 1024
-	depends on SMP
-	default "64"
+	int "Maximum number of CPUs (2-1024)" if SMP
+	range 2 1024 if SMP
+	default "1" if !SMP
+	default "64" if SMP
 
 source "drivers/cpufreq/Kconfig"
 
--- test-compile.orig/arch/um/Kconfig
+++ test-compile/arch/um/Kconfig
@@ -198,10 +198,10 @@ config SMP
 	  If you don't know what to do, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
-	range 2 32
-	depends on SMP
-	default "32"
+	int "Maximum number of CPUs (2-32)" if SMP
+	range 2 32 if SMP
+	default "1" if !SMP
+	default "32" if SMP
 
 config HIGHMEM
 	bool "Highmem support (EXPERIMENTAL)"
--- test-compile.orig/arch/x86/Kconfig
+++ test-compile/arch/x86/Kconfig
@@ -586,12 +586,11 @@ endif
 
 if !MAXSMP
 config NR_CPUS
-	int "Maximum number of CPUs (2-512)" if !MAXSMP
-	range 2 512
-	depends on SMP
-	default "4096" if MAXSMP
-	default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
-	default "8"
+	int "Maximum number of CPUs (2-512)" if SMP
+	range 2 512 if SMP
+	default "1" if !SMP
+	default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
+	default "8" if SMP
 	help
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  The maximum supported value is 512 and the
--- test-compile.orig/include/linux/threads.h
+++ test-compile/include/linux/threads.h
@@ -8,16 +8,10 @@
  */
 
 /*
- * Maximum supported processors that can run under SMP.  This value is
- * set via configure setting.  The maximum is equal to the size of the
- * bitmasks used on that platform, i.e. 32 or 64.  Setting this smaller
- * saves quite a bit of memory.
+ * Maximum supported processors.  Setting this smaller saves quite a
+ * bit of memory.  Use nr_cpu_ids instead of this except for bitmaps.
  */
-#ifdef CONFIG_SMP
 #define NR_CPUS		CONFIG_NR_CPUS
-#else
-#define NR_CPUS		1
-#endif
 
 #define MIN_THREADS_LEFT_FOR_ROOT 4
 

-- 

  parent reply	other threads:[~2008-10-20 17:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 17:03 [PATCH 00/35] cpumask: Replace cpumask_t with struct cpumask Mike Travis
2008-10-20 17:03 ` [PATCH 01/35] x86: clean up speedctep-centrino and reduce cpumask_t usage Mike Travis
2008-10-21  0:09   ` Stephen Rothwell
2008-10-21 12:28     ` Mike Travis
2008-10-20 17:03 ` [PATCH 02/35] cpumask: remove min from first_cpu/next_cpu Mike Travis
2008-10-20 17:03 ` [PATCH 03/35] cpumask: add for_each_cpu_mask_and function Mike Travis
2008-10-20 17:03 ` [PATCH 04/35] x86 smp: modify send_IPI_mask interface to accept cpumask_t pointers Mike Travis
2008-10-20 17:03 ` [PATCH 05/35] sched: Reduce stack size requirements in kernel/sched.c Mike Travis
2008-10-20 17:03 ` [PATCH 06/35] cpumask: introduce struct cpumask Mike Travis
2008-10-20 17:03 ` [PATCH 07/35] cpumask: change cpumask_scnprintf, cpumask_parse_user, cpulist_parse, and cpulist_scnprintf to take pointers Mike Travis
2008-10-20 17:03 ` [PATCH 08/35] cpumask: cpumask_size() Mike Travis
2008-10-20 17:03 ` [PATCH 09/35] cpumask: add cpumask_copy() Mike Travis
2008-10-20 17:03 ` [PATCH 10/35] cpumask: introduce cpumask_var_t for local cpumask vars Mike Travis
2008-10-20 17:03 ` [PATCH 11/35] x86: enable MAXSMP Mike Travis
2008-10-20 17:03 ` Mike Travis [this message]
2008-10-20 17:03 ` [PATCH 13/35] cpumask: use setup_nr_cpu_ids() instead of direct assignment Mike Travis
2008-10-20 17:03 ` [PATCH 14/35] cpumask: make nr_cpu_ids valid in all configurations Mike Travis
2008-10-20 17:03 ` [PATCH 15/35] cpumask: prepare for iterators to only go to nr_cpu_ids Mike Travis
2008-10-20 17:03 ` [PATCH 16/35] percpu: fix percpu accessors to potentially !cpu_possible() cpus Mike Travis
2008-10-20 17:03 ` [PATCH 17/35] cpumask: make nr_cpu_ids the actual limit on bitmap size Mike Travis
2008-10-20 17:03 ` [PATCH 18/35] cpumask: add nr_cpumask_bits Mike Travis
2008-10-21 12:26   ` Rusty Russell
2008-10-21 13:53     ` Mike Travis
2008-10-20 17:03 ` [PATCH 19/35] cpumask: use cpumask_bits() everywhere Mike Travis
2008-10-20 17:03 ` [PATCH 20/35] cpumask: cpumask_of(): cpumask_of_cpu() which returns a pointer Mike Travis
2008-10-20 17:03 ` [PATCH 21/35] cpumask: for_each_cpu(): for_each_cpu_mask which takes " Mike Travis
2008-10-20 17:03 ` [PATCH 22/35] cpumask: cpumask_first/cpumask_next Mike Travis
2008-10-20 17:03 ` [PATCH 23/35] cpumask: deprecate any_online_cpu() in favour of cpumask_any/cpumask_any_and Mike Travis
2008-10-20 17:03 ` [PATCH 24/35] cpumask: cpumask_any_but() Mike Travis
2008-10-20 17:03 ` [PATCH 25/35] cpumask: Deprecate CPUMASK_ALLOC etc in favor of cpumask_var_t Mike Travis
2008-10-20 17:03 ` [PATCH 26/35] cpumask: get rid of boutique sched.c allocations, use cpumask_var_t Mike Travis
2008-10-20 17:03 ` [PATCH 27/35] cpumask: to_cpumask() Mike Travis
2008-10-20 17:03 ` [PATCH 28/35] cpumask: accessors to manipulate possible/present/online/active maps Mike Travis
2008-10-20 17:03 ` [PATCH 29/35] cpumask: Use accessors code Mike Travis
2008-10-20 17:03 ` [PATCH 30/35] cpumask: CONFIG_BITS_ALL, CONFIG_BITS_NONE and CONFIG_BITS_CPU0 Mike Travis
2008-10-20 17:03 ` [PATCH 31/35] cpumask: switch over to cpu_online/possible/active/present_mask Mike Travis
2008-10-20 17:03 ` [PATCH 32/35] cpumask: cpu_all_mask and cpu_none_mask Mike Travis
2008-10-20 17:03 ` [PATCH 33/35] cpumask: reorder header to minimize separate #ifdefs Mike Travis
2008-10-20 17:03 ` [PATCH 34/35] cpumask: debug options for cpumasks Mike Travis
2008-10-20 17:03 ` [PATCH 35/35] cpumask: smp_call_function_many() Mike Travis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081020170321.260062000@polaris-admin.engr.sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=dada1@cosmosbay.com \
    --cc=davej@codemonkey.org.uk \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=jes@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sparclinux@vger.kernel.org \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=yhlu.kernel@gmail.com \
    --subject='Re: [PATCH 12/35] cpumask: make CONFIG_NR_CPUS always valid.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).