Configure the max number of cpus at compile time (default was 32). Saves memory footprint for kernel (around 240Kb in 32->2). Author: Andrew Morton , Robert Love --- linux/Documentation/Configure.help.orig 2002-06-06 15:48:03.000000000 +0200 +++ linux/Documentation/Configure.help 2002-06-06 15:47:15.000000000 +0200 @@ -137,6 +137,15 @@ If you don't know what to do here, say N. +Maximum number of CPUs +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. + Intel or compatible 80x86 processor CONFIG_X86 This is Linux's home port. Linux was originally native to the Intel --- linux/include/linux/threads.h.orig 2002-06-06 15:44:27.000000000 +0200 +++ linux/include/linux/threads.h 2002-06-06 15:45:40.000000000 +0200 @@ -9,9 +9,9 @@ */ #ifdef CONFIG_SMP -#define NR_CPUS 32 /* Max processors that can be running in SMP */ +#define NR_CPUS CONFIG_NR_CPUS #else -#define NR_CPUS 1 +#define NR_CPUS 1 #endif #define MIN_THREADS_LEFT_FOR_ROOT 4 --- linux/arch/i386/kernel/smpboot.c.orig 2002-06-06 15:48:19.000000000 +0200 +++ linux/arch/i386/kernel/smpboot.c 2002-06-06 15:49:14.000000000 +0200 @@ -51,7 +51,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; @@ -1116,7 +1116,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); --- linux/arch/i386/config.in.orig 2002-06-06 15:43:12.000000000 +0200 +++ linux/arch/i386/config.in 2002-06-06 15:43:37.000000000 +0200 @@ -230,6 +230,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 --- linux/arch/i386/defconfig Wed Jun 19 17:32:33 2002 +++ linux/arch/i386/defconfig Wed Jun 19 17:26:35 2002 @@ -65,6 +65,7 @@ CONFIG_SMP=y # CONFIG_MULTIQUAD is not set CONFIG_HAVE_DEC_LOCK=y +CONFIG_NR_CPUS=32 # # General setup --- linux/arch/alpha/config.in Wed Jun 19 17:31:21 2002 +++ linux/arch/alpha/config.in Wed Jun 19 17:26:35 2002 @@ -245,6 +245,7 @@ if [ "$CONFIG_SMP" = "y" ]; then define_bool CONFIG_HAVE_DEC_LOCK y + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then --- linux/arch/ia64/config.in Wed Jun 19 17:32:34 2002 +++ linux/arch/ia64/config.in Wed Jun 19 17:26:35 2002 @@ -91,6 +91,10 @@ define_bool CONFIG_KCORE_ELF y # On IA-64, we always want an ELF /proc/kcore. bool 'SMP support' CONFIG_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 +fi + tristate 'Support running of Linux/x86 binaries' CONFIG_IA32_SUPPORT bool 'Performance monitor support' CONFIG_PERFMON tristate '/proc/pal support' CONFIG_IA64_PALINFO --- linux/arch/ia64/defconfig Wed Jun 19 17:31:23 2002 +++ linux/arch/ia64/defconfig Wed Jun 19 17:26:35 2002 @@ -43,6 +43,7 @@ CONFIG_PM=y CONFIG_KCORE_ELF=y CONFIG_SMP=y +CONFIG_NR_CPUS=64 CONFIG_IA32_SUPPORT=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y --- linux/arch/mips/config-shared.in Wed Jun 19 17:32:34 2002 +++ linux/arch/mips/config-shared.in Wed Jun 19 17:26:35 2002 @@ -796,6 +796,8 @@ bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ if [ "$CONFIG_SMP" != "y" ]; then bool 'Run uncached' CONFIG_MIPS_UNCACHED +else + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 fi endmenu --- linux/arch/mips64/defconfig Wed Jun 19 17:31:25 2002 +++ linux/arch/mips64/defconfig Wed Jun 19 17:26:35 2002 @@ -53,6 +53,7 @@ # CONFIG_REPLICATE_KTEXT is not set # CONFIG_REPLICATE_EXHANDLERS is not set CONFIG_SMP=y +CONFIG_NR_CPUS=64 # CONFIG_SGI_IP32 is not set # CONFIG_SIBYTE_SB1xxx_SOC is not set # CONFIG_SNI_RM200_PCI is not set --- linux/arch/parisc/config.in Wed Jun 19 17:32:34 2002 +++ linux/arch/parisc/config.in Wed Jun 19 17:26:35 2002 @@ -43,6 +43,10 @@ comment 'General options' bool 'Symmetric multi-processing support' CONFIG_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 +fi + bool 'Chassis LCD and LED support' CONFIG_CHASSIS_LCD_LED bool 'Kernel Debugger support' CONFIG_KWDB --- linux/arch/ppc/config.in Wed Jun 19 17:31:16 2002 +++ linux/arch/ppc/config.in Wed Jun 19 17:26:35 2002 @@ -108,6 +108,7 @@ bool 'Symmetric multi-processing support' CONFIG_SMP if [ "$CONFIG_SMP" = "y" ]; then bool ' Distribute interrupts on all CPUs by default' CONFIG_IRQ_ALL_CPUS + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 fi if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "n" ];then --- linux/arch/ppc64/config.in Wed Jun 19 17:31:23 2002 +++ linux/arch/ppc64/config.in Wed Jun 19 17:26:35 2002 @@ -27,6 +27,7 @@ bool 'Symmetric multi-processing support' CONFIG_SMP if [ "$CONFIG_SMP" = "y" ]; then bool ' Distribute interrupts on all CPUs by default' CONFIG_IRQ_ALL_CPUS + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 if [ "$CONFIG_PPC_PSERIES" = "y" ]; then bool ' Hardware multithreading' CONFIG_HMT fi --- linux/arch/ppc64/defconfig Wed Jun 19 17:31:23 2002 +++ linux/arch/ppc64/defconfig Wed Jun 19 17:26:35 2002 @@ -22,6 +22,7 @@ CONFIG_PPC_PSERIES=y # CONFIG_PPC_ISERIES is not set CONFIG_SMP=y +CONFIG_NR_CPUS=64 CONFIG_IRQ_ALL_CPUS=y # CONFIG_HMT is not set # CONFIG_MSCHUNKS is not set --- linux/arch/s390/config.in Wed Jun 19 17:31:26 2002 +++ linux/arch/s390/config.in Wed Jun 19 17:26:35 2002 @@ -30,6 +30,9 @@ comment 'Processor type and features' bool 'Symmetric multi-processing support' CONFIG_SMP bool 'IEEE FPU emulation' CONFIG_MATHEMU +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 +fi endmenu mainmenu_option next_comment --- linux/arch/s390/defconfig Wed Jun 19 17:31:26 2002 +++ linux/arch/s390/defconfig Wed Jun 19 17:26:35 2002 @@ -27,6 +27,7 @@ # CONFIG_SMP=y CONFIG_MATHEMU=y +CONFIG_NR_CPUS=64 # # General setup --- linux/arch/s390x/config.in Wed Jun 19 17:31:25 2002 +++ linux/arch/s390x/config.in Wed Jun 19 17:26:35 2002 @@ -20,6 +20,9 @@ mainmenu_option next_comment comment 'Processor type and features' bool 'Symmetric multi-processing support' CONFIG_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 +fi bool 'Kernel support for 31 bit emulation' CONFIG_S390_SUPPORT if [ "$CONFIG_S390_SUPPORT" = "y" ]; then tristate 'Kernel support for 31 bit ELF binaries' CONFIG_BINFMT_ELF32 --- linux/arch/s390x/defconfig Wed Jun 19 17:31:25 2002 +++ linux/arch/s390x/defconfig Wed Jun 19 17:26:35 2002 @@ -21,6 +21,7 @@ CONFIG_SMP=y CONFIG_S390_SUPPORT=y CONFIG_BINFMT_ELF32=y +CONFIG_NR_CPUS=64 # # Loadable module support --- linux/arch/sparc/config.in Wed Jun 19 17:31:21 2002 +++ linux/arch/sparc/config.in Wed Jun 19 17:26:35 2002 @@ -29,6 +29,10 @@ bool 'Symmetric multi-processing support (does not work on sun4/sun4c)' CONFIG_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 +fi + # Identify this as a Sparc32 build define_bool CONFIG_SPARC32 y --- linux/arch/sparc64/config.in Wed Jun 19 17:32:35 2002 +++ linux/arch/sparc64/config.in Wed Jun 19 17:26:35 2002 @@ -28,6 +28,10 @@ bool 'Symmetric multi-processing support' CONFIG_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 +fi + # Identify this as a Sparc64 build define_bool CONFIG_SPARC64 y --- linux/arch/sparc64/defconfig Wed Jun 19 17:32:35 2002 +++ linux/arch/sparc64/defconfig Wed Jun 19 17:26:35 2002 @@ -58,6 +58,7 @@ CONFIG_BINFMT_MISC=m # CONFIG_SUNOS_EMUL is not set CONFIG_SOLARIS_EMUL=m +CONFIG_NR_CPUS=64 # # Parallel port support --- linux/arch/x86_64/config.in Wed Jun 19 17:31:25 2002 +++ linux/arch/x86_64/config.in Wed Jun 19 17:29:25 2002 @@ -64,6 +64,7 @@ define_bool CONFIG_X86_UP_IOAPIC y else define_bool CONFIG_HAVE_DEC_LOCK y + int 'Maximum number of CPUs (2-64)' CONFIG_NR_CPUS 64 fi bool 'Machine check support' CONFIG_MCE --- linux/arch/x86_64/defconfig Wed Jun 19 17:31:25 2002 +++ linux/arch/x86_64/defconfig Wed Jun 19 17:26:35 2002 @@ -41,6 +41,7 @@ CONFIG_X86_LOCAL_APIC=y CONFIG_MTRR=y # CONFIG_SMP is not set +CONFIG_NR_CPUS=64 CONFIG_HPET_TIMER=y # CONFIG_GART_IOMMU is not set CONFIG_DUMMY_IOMMU=y --- linux-2.4.20/arch/um/config.in Sun Mar 16 01:41:53 2003 +++ linux-2.4.20-nr_cpus/arch/um/config.in Sun Mar 16 02:35:52 2003 @@ -44,6 +44,9 @@ bool '2G/2G host address space split' CONFIG_HOST_2G_2G bool 'Symmetric multi-processing support' CONFIG_UML_SMP define_bool CONFIG_SMP $CONFIG_UML_SMP +if [ "$CONFIG_SMP" = "y" ]; then + int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32 +fi int 'Nesting level' CONFIG_NEST_LEVEL 0 int 'Kernel address space size (in .5G units)' CONFIG_KERNEL_HALF_GIGS 1 bool 'Highmem support' CONFIG_HIGHMEM --- linux-2.4.20/arch/um/defconfig Sun Mar 16 01:41:53 2003 +++ linux-2.4.20-nr_cpus/arch/um/defconfig Sun Mar 16 02:36:38 2003 @@ -32,6 +32,7 @@ # CONFIG_HOST_2G_2G is not set # CONFIG_UML_SMP is not set # CONFIG_SMP is not set +CONFIG_NR_CPUS=32 CONFIG_NEST_LEVEL=0 CONFIG_KERNEL_HALF_GIGS=1 # CONFIG_HIGHMEM is not set