CONFIG_SMP_CPUS

From: willy@thepuffingroup.com
Date: Sun Jul 09 2000 - 14:51:34 EST


we have a lot of arrays which are declared as being NR_CPUS elements large.
this is clearly suboptimal on the majority of SMP machines which have
only 2 CPUs. i therefore believe this should be a config option. what
do you think to this patch?

willy@femmeviolet:~/kernels/linux-2.4.0-t3p7$ ls -l vmlinux
-rwxr-xr-x 1 willy willy 2622108 Jul 9 16:50 vmlinux
(before, NR_CPUS = 32)

willy@femmeviolet:~/kernels/linux-willy$ ls -l vmlinux
-rwxr-xr-x 1 willy willy 2572764 Jul 9 16:50 vmlinux
(after, NR_CPUS = 2)

I think having 50k back is worthwhile, don't you?

diff -urNX exclude linux-2.4.0-t3p7/arch/i386/config.in linux-willy/arch/i386/config.in
--- linux-2.4.0-t3p7/arch/i386/config.in Sun Jul 9 13:01:31 2000
+++ linux-willy/arch/i386/config.in Sun Jul 9 16:19:47 2000
@@ -139,6 +139,9 @@
        define_bool CONFIG_X86_IO_APIC y
        define_bool CONFIG_X86_LOCAL_APIC y
     fi
+ define_int CONFIG_SMP_CPUS 1
+else
+ int 'Maximum number of CPUs to support (1-32)' CONFIG_SMP_CPUS 2
 fi
 if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
     define_bool CONFIG_HAVE_DEC_LOCK y
diff -urNX exclude linux-2.4.0-t3p7/include/linux/threads.h linux-willy/include/linux/threads.h
--- linux-2.4.0-t3p7/include/linux/threads.h Wed May 24 22:52:41 2000
+++ linux-willy/include/linux/threads.h Sun Jul 9 16:20:19 2000
@@ -8,11 +8,7 @@
  * /proc/sys/kernel/max-threads.
  */
  
-#ifdef CONFIG_SMP
-#define NR_CPUS 32 /* Max processors that can be running in SMP */
-#else
-#define NR_CPUS 1
-#endif
+#define NR_CPUS CONFIG_SMP_CPUS /* Max processors that can be running in SMP */
 
 #define MIN_THREADS_LEFT_FOR_ROOT 4
 

-- 
The Sex Pistols were revolutionaries.  The Bay City Rollers weren't.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:10 EST