From: Yasunori Goto Current implementations define NODES_SHIFT in include/asm-xxx/numnodes.h for each arch. Its definition is sometimes configurable. Indeed, ia64 defines 5 NODES_SHIFT values in the current git tree. But it looks a bit messy. SGI-SN2(ia64) system requires 1024 nodes, and the number of nodes already has been changeable by config. Suitable node's number may be changed in the future even if it is other architecture. So, I wrote configurable node's number. This patch set defines just default value for each arch which needs multi nodes except ia64. But, it is easy to change to configurable if necessary. On ia64 the number of nodes can be already configured in generic ia64 and SN2 config. But, NODES_SHIFT is defined for DIG64 and HP'S machine too. So, I changed it so that all platforms can be configured via CONFIG_NODES_SHIFT. It would be simpler. See also: http://marc.theaimsgroup.com/?l=linux-kernel&m=114358010523896&w=2 Signed-off-by: Yasunori Goto Cc: Hirokazu Takata Cc: "Luck, Tony" Cc: Andi Kleen Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Ivan Kokshaysky Cc: Richard Henderson Cc: Kyle McMartin Cc: Russell King Cc: Ralf Baechle Cc: Jack Steiner Signed-off-by: Andrew Morton --- dev/null | 126 ------------------------ arch/alpha/Kconfig | 5 arch/arm/Kconfig | 6 + arch/i386/Kconfig | 6 + arch/ia64/Kconfig | 19 +-- arch/m32r/Kconfig | 5 arch/mips/Kconfig | 5 arch/parisc/Kconfig | 5 arch/powerpc/Kconfig | 5 arch/sh/Kconfig | 5 arch/x86_64/Kconfig | 5 include/asm-arm/arch-lh7a40x/memory.h | 2 include/asm-x86_64/numa.h | 1 include/linux/numa.h | 8 - 14 files changed, 60 insertions(+), 143 deletions(-) diff -puN arch/alpha/Kconfig~configurable-nodes_shift arch/alpha/Kconfig --- devel/arch/alpha/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/alpha/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -549,6 +549,11 @@ config NUMA Access). This option is for configuring high-end multiprocessor server machines. If in doubt, say N. +config NODES_SHIFT + int + default "7" + depends on NEED_MULTIPLE_NODES + # LARGE_VMALLOC is racy, if you *really* need it then fix it first config ALPHA_LARGE_VMALLOC bool diff -puN arch/arm/Kconfig~configurable-nodes_shift arch/arm/Kconfig --- devel/arch/arm/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/arm/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -512,6 +512,12 @@ config ARCH_DISCONTIGMEM_ENABLE or have huge holes in the physical address space for other reasons. See for more. +config NODES_SHIFT + int + default "4" if ARCH_LH7A40X + default "2" + depends on NEED_MULTIPLE_NODES + source "mm/Kconfig" config LEDS diff -puN arch/i386/Kconfig~configurable-nodes_shift arch/i386/Kconfig --- devel/arch/i386/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/i386/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -521,6 +521,12 @@ config NUMA comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) +config NODES_SHIFT + int + default "4" if X86_NUMAQ + default "3" + depends on NEED_MULTIPLE_NODES + config HAVE_ARCH_BOOTMEM_NODE bool depends on NUMA diff -puN arch/ia64/Kconfig~configurable-nodes_shift arch/ia64/Kconfig --- devel/arch/ia64/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/ia64/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -261,15 +261,6 @@ config NR_CPUS than 64 will cause the use of a CPU mask array, causing a small performance hit. -config IA64_NR_NODES - int "Maximum number of NODEs (256-1024)" if (IA64_SGI_SN2 || IA64_GENERIC) - range 256 1024 - depends on IA64_SGI_SN2 || IA64_GENERIC - default "256" - help - This option specifies the maximum number of nodes in your SSI system. - If in doubt, use the default. - config HOTPLUG_CPU bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" depends on SMP && EXPERIMENTAL @@ -353,6 +344,16 @@ config NUMA Access). This option is for configuring high-end multiprocessor server systems. If in doubt, say N. +config NODES_SHIFT + int "Max num nodes shift(3-10)" + range 3 10 + default "8" + depends on NEED_MULTIPLE_NODES + help + This option specifies the maximum number of nodes in your SSI system. + MAX_NUMNODES will be 2^(This value). + If in doubt, use the default. + # VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent. # VIRTUAL_MEM_MAP has been retained for historical reasons. config VIRTUAL_MEM_MAP diff -puN arch/m32r/Kconfig~configurable-nodes_shift arch/m32r/Kconfig --- devel/arch/m32r/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/m32r/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -285,6 +285,11 @@ config NUMA depends on SMP && BROKEN default n +config NODES_SHIFT + int + default "1" + depends on NEED_MULTIPLE_NODES + # turning this on wastes a bunch of space. # Summit needs it only when NUMA is on config BOOT_IOREMAP diff -puN arch/mips/Kconfig~configurable-nodes_shift arch/mips/Kconfig --- devel/arch/mips/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/mips/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -1590,6 +1590,11 @@ config ARCH_FLATMEM_ENABLE def_bool y depends on !NUMA +config NODES_SHIFT + int + default "6" + depends on NEED_MULTIPLE_NODES + source "mm/Kconfig" config SMP diff -puN arch/parisc/Kconfig~configurable-nodes_shift arch/parisc/Kconfig --- devel/arch/parisc/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/parisc/Kconfig 2006-03-29 22:49:50.000000000 -0800 @@ -177,6 +177,11 @@ config ARCH_DISCONTIGMEM_DEFAULT def_bool y depends on ARCH_DISCONTIGMEM_ENABLE +config NODES_SHIFT + int + default "3" + depends on NEED_MULTIPLE_NODES + source "kernel/Kconfig.preempt" source "kernel/Kconfig.hz" source "mm/Kconfig" diff -puN arch/powerpc/Kconfig~configurable-nodes_shift arch/powerpc/Kconfig --- devel/arch/powerpc/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/powerpc/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -649,6 +649,11 @@ config NUMA depends on PPC64 default y if SMP && PPC_PSERIES +config NODES_SHIFT + int + default "4" + depends on NEED_MULTIPLE_NODES + config ARCH_SELECT_MEMORY_MODEL def_bool y depends on PPC64 diff -puN arch/sh/Kconfig~configurable-nodes_shift arch/sh/Kconfig --- devel/arch/sh/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/sh/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -527,6 +527,11 @@ config CPU_HAS_SR_RB See for further information on SR.RB and register banking in the kernel in general. +config NODES_SHIFT + int + default "1" + depends on NEED_MULTIPLE_NODES + endmenu menu "Boot options" diff -puN arch/x86_64/Kconfig~configurable-nodes_shift arch/x86_64/Kconfig --- devel/arch/x86_64/Kconfig~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/arch/x86_64/Kconfig 2006-03-29 22:49:21.000000000 -0800 @@ -283,6 +283,11 @@ config K8_NUMA Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA instead, which also takes priority if both are compiled in. +config NODES_SHIFT + int + default "6" + depends on NEED_MULTIPLE_NODES + # Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig. config X86_64_ACPI_NUMA diff -L include/asm-alpha/numnodes.h -puN include/asm-alpha/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-alpha/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,7 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -/* Max 128 Nodes - Marvel */ -#define NODES_SHIFT 7 - -#endif /* _ASM_MAX_NUMNODES_H */ diff -puN include/asm-arm/arch-lh7a40x/memory.h~configurable-nodes_shift include/asm-arm/arch-lh7a40x/memory.h --- devel/include/asm-arm/arch-lh7a40x/memory.h~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/include/asm-arm/arch-lh7a40x/memory.h 2006-03-29 22:49:21.000000000 -0800 @@ -31,8 +31,6 @@ #ifdef CONFIG_DISCONTIGMEM -#define NODES_SHIFT 4 /* Up to 16 nodes */ - /* * Given a kernel address, find the home node of the underlying memory. */ diff -L include/asm-arm/numnodes.h -puN include/asm-arm/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-arm/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,26 +0,0 @@ -/* - * linux/include/asm-arm/numnodes.h - * - * Copyright (C) 2002 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* This declaration for the size of the NUMA (CONFIG_DISCONTIGMEM) - * memory node table is the default. - * - * A good place to override this value is include/asm/arch/memory.h. - */ - -#ifndef __ASM_ARM_NUMNODES_H -#define __ASM_ARM_NUMNODES_H - -#include - -#ifndef NODES_SHIFT -# define NODES_SHIFT 2 /* Normally, Max 4 Nodes */ -#endif - -#endif diff -L include/asm-i386/numnodes.h -puN include/asm-i386/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-i386/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,18 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -#include - -#ifdef CONFIG_X86_NUMAQ - -/* Max 16 Nodes */ -#define NODES_SHIFT 4 - -#elif defined(CONFIG_ACPI_SRAT) - -/* Max 8 Nodes */ -#define NODES_SHIFT 3 - -#endif /* CONFIG_X86_NUMAQ */ - -#endif /* _ASM_MAX_NUMNODES_H */ diff -L include/asm-ia64/numnodes.h -puN include/asm-ia64/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-ia64/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,20 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -#ifdef CONFIG_IA64_DIG -/* Max 8 Nodes */ -# define NODES_SHIFT 3 -#elif defined(CONFIG_IA64_HP_ZX1) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB) -/* Max 32 Nodes */ -# define NODES_SHIFT 5 -#elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC) -# if CONFIG_IA64_NR_NODES == 256 -# define NODES_SHIFT 8 -# elif CONFIG_IA64_NR_NODES <= 512 -# define NODES_SHIFT 9 -# elif CONFIG_IA64_NR_NODES <= 1024 -# define NODES_SHIFT 10 -# endif -#endif - -#endif /* _ASM_MAX_NUMNODES_H */ diff -L include/asm-m32r/numnodes.h -puN include/asm-m32r/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-m32r/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,15 +0,0 @@ -#ifndef _ASM_NUMNODES_H_ -#define _ASM_NUMNODES_H_ - -#include - -#ifdef CONFIG_DISCONTIGMEM - -#if defined(CONFIG_CHIP_M32700) -#define NODES_SHIFT 1 /* Max 2 Nodes */ -#endif /* CONFIG_CHIP_M32700 */ - -#endif /* CONFIG_DISCONTIGMEM */ - -#endif /* _ASM_NUMNODES_H_ */ - diff -L include/asm-mips/numnodes.h -puN include/asm-mips/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-mips/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,7 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -/* Max 128 Nodes */ -#define NODES_SHIFT 6 - -#endif /* _ASM_MAX_NUMNODES_H */ diff -L include/asm-parisc/numnodes.h -puN include/asm-parisc/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-parisc/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,7 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -/* Max 8 Nodes */ -#define NODES_SHIFT 3 - -#endif /* _ASM_MAX_NUMNODES_H */ diff -L include/asm-powerpc/numnodes.h -puN include/asm-powerpc/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-powerpc/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,9 +0,0 @@ -#ifndef _ASM_POWERPC_MAX_NUMNODES_H -#define _ASM_POWERPC_MAX_NUMNODES_H -#ifdef __KERNEL__ - -/* Max 16 Nodes */ -#define NODES_SHIFT 4 - -#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_MAX_NUMNODES_H */ diff -L include/asm-sh/numnodes.h -puN include/asm-sh/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-sh/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,7 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -/* Max 2 Nodes */ -#define NODES_SHIFT 1 - -#endif /* _ASM_MAX_NUMNODES_H */ diff -puN include/asm-x86_64/numa.h~configurable-nodes_shift include/asm-x86_64/numa.h --- devel/include/asm-x86_64/numa.h~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/include/asm-x86_64/numa.h 2006-03-29 22:49:21.000000000 -0800 @@ -2,7 +2,6 @@ #define _ASM_X8664_NUMA_H 1 #include -#include struct bootnode { u64 start,end; diff -L include/asm-x86_64/numnodes.h -puN include/asm-x86_64/numnodes.h~configurable-nodes_shift /dev/null --- devel/include/asm-x86_64/numnodes.h +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,10 +0,0 @@ -#ifndef _ASM_X8664_NUMNODES_H -#define _ASM_X8664_NUMNODES_H 1 - -#include - -#ifdef CONFIG_NUMA -#define NODES_SHIFT 6 -#endif - -#endif diff -puN include/linux/numa.h~configurable-nodes_shift include/linux/numa.h --- devel/include/linux/numa.h~configurable-nodes_shift 2006-03-29 22:49:21.000000000 -0800 +++ devel-akpm/include/linux/numa.h 2006-03-29 22:49:21.000000000 -0800 @@ -3,11 +3,9 @@ #include -#ifndef CONFIG_FLATMEM -#include -#endif - -#ifndef NODES_SHIFT +#ifdef CONFIG_NODES_SHIFT +#define NODES_SHIFT CONFIG_NODES_SHIFT +#else #define NODES_SHIFT 0 #endif _