mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: "David S. Miller" <davem@redhat.com>
Cc: akpm@zip.com.au, linux-kernel@vger.kernel.org
Subject: Re: [patch] CONFIG_NR_CPUS
Date: 06 Jun 2002 08:26:52 -0700	[thread overview]
Message-ID: <1023377213.13787.2.camel@sinai> (raw)
In-Reply-To: <20020606.031520.08940800.davem@redhat.com>

On Thu, 2002-06-06 at 03:15, David S. Miller wrote:
 
> Nice.  While you're at it can you fix the value on 64-bit
> platforms when CONFIG_NR_CPUS is not specified?  (it should
> be 64, not 32)

I agree, this is good.  I often am toying with some debugging aid that
is an array of NR_CPUS and waste a lot of memory with NR_CPUS stuck at
32... no reason my kernels should not be set to 2 or whatever I need.

I have attached a patch that is Andrew's + your request, Dave.  Since
what really determines the maximum number of CPUs is the size of
unsigned long, I used that.  Cool?

	Robert Love

diff -urN linux-2.5.20/arch/i386/Config.help linux/arch/i386/Config.help
--- linux-2.5.20/arch/i386/Config.help	Sun Jun  2 18:44:41 2002
+++ linux/arch/i386/Config.help	Thu Jun  6 07:58:58 2002
@@ -25,6 +25,14 @@
 
   If you don't know what to do here, say N.
 
+CONFIG_NR_CPUS
+  This allows you to specify the maximum number of CPUs which this
+  kernel will support.  The maximum supported value is 32 and the
+  mimimum value which makes sense is 2.
+
+  This is purely to save memory - each supported CPU adds
+  approximately eight kilobytes to the kernel image.
+
 CONFIG_PREEMPT
   This option reduces the latency of the kernel when reacting to
   real-time or interactive events by allowing a low priority process to
diff -urN linux-2.5.20/arch/i386/config.in linux/arch/i386/config.in
--- linux-2.5.20/arch/i386/config.in	Sun Jun  2 18:44:46 2002
+++ linux/arch/i386/config.in	Thu Jun  6 07:58:58 2002
@@ -185,8 +185,8 @@
 
 bool 'Math emulation' CONFIG_MATH_EMULATION
 bool 'MTRR (Memory Type Range Register) support' CONFIG_MTRR
-bool 'Symmetric multi-processing support' CONFIG_SMP
 bool 'Preemptible Kernel' CONFIG_PREEMPT
+bool 'Symmetric multi-processing support' CONFIG_SMP
 if [ "$CONFIG_SMP" != "y" ]; then
    bool 'Local APIC support on uniprocessors' CONFIG_X86_UP_APIC
    dep_bool 'IO-APIC support on uniprocessors' CONFIG_X86_UP_IOAPIC $CONFIG_X86_UP_APIC
@@ -197,6 +197,7 @@
       define_bool CONFIG_X86_IO_APIC y
    fi
 else
+   int  'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32
    bool 'Multiquad NUMA system' CONFIG_MULTIQUAD
 fi
 
diff -urN linux-2.5.20/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c
--- linux-2.5.20/arch/i386/kernel/smpboot.c	Sun Jun  2 18:44:49 2002
+++ linux/arch/i386/kernel/smpboot.c	Thu Jun  6 07:58:58 2002
@@ -54,7 +54,7 @@
 static int smp_b_stepping;
 
 /* Setup configured maximum number of CPUs to activate */
-static int max_cpus = -1;
+static int max_cpus = NR_CPUS;
 
 /* Total count of live CPUs */
 int smp_num_cpus = 1;
@@ -1145,7 +1145,7 @@
 
 		if (!(phys_cpu_present_map & (1 << bit)))
 			continue;
-		if ((max_cpus >= 0) && (max_cpus <= cpucount+1))
+		if (max_cpus <= cpucount+1)
 			continue;
 
 		do_boot_cpu(apicid);
diff -urN linux-2.5.20/include/linux/threads.h linux/include/linux/threads.h
--- linux-2.5.20/include/linux/threads.h	Sun Jun  2 18:44:39 2002
+++ linux/include/linux/threads.h	Thu Jun  6 08:01:29 2002
@@ -7,11 +7,18 @@
  * The default limit for the nr of threads is now in
  * /proc/sys/kernel/threads-max.
  */
- 
+
+/* Max processors that can be running in SMP */
 #ifdef CONFIG_SMP
-#define NR_CPUS	32		/* Max processors that can be running in SMP */
+
+#ifdef CONFIG_NR_CPUS
+#define NR_CPUS	CONFIG_NR_CPUS
+#else
+#define NR_CPUS	(sizeof(unsigned long) * 8)
+#endif
+
 #else
-#define NR_CPUS 1
+#define NR_CPUS	1
 #endif
 
 #define MIN_THREADS_LEFT_FOR_ROOT 4


  reply	other threads:[~2002-06-06 15:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-06 10:10 Andrew Morton
2002-06-06 10:15 ` David S. Miller
2002-06-06 15:26   ` Robert Love [this message]
2002-06-06 17:05     ` Tom Rini
2002-06-06 17:09     ` Adam Kropelin
2002-06-06 17:52       ` Robert Love
2002-06-06 19:48     ` Andrew Morton
2002-06-06 20:55       ` Andreas Dilger
2002-06-06 21:04         ` Andrew Morton
2002-06-06 21:23       ` Thomas 'Dent' Mirlacher
2002-06-06 21:36         ` Dave Jones
2002-06-06 21:49           ` Thomas 'Dent' Mirlacher

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=1023377213.13787.2.camel@sinai \
    --to=rml@tech9.net \
    --cc=akpm@zip.com.au \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®