From: Matthew Dobson Make sure MAX_NUMNODES is defined in one and only one place. Remove superfluous definitions. Instead of defining MAX_NUMNODES in asm/numnodes.h, we define NODES_SHIFT there. Then in linux/mmzone.h we turn that NODES_SHIFT value into MAX_NUMNODES. include/asm-alpha/numnodes.h | 3 ++- include/asm-i386/numaq.h | 1 - include/asm-i386/numnodes.h | 14 +++++++++----- include/asm-i386/srat.h | 1 - include/asm-ppc64/numnodes.h | 3 ++- include/asm-x86_64/mmzone.h | 1 - include/asm-x86_64/numnodes.h | 7 ++----- include/linux/mmzone.h | 5 +++-- mm/slab.c | 2 +- 9 files changed, 19 insertions(+), 18 deletions(-) diff -puN include/asm-alpha/numnodes.h~node-enumeration-cleanup-01 include/asm-alpha/numnodes.h --- 25/include/asm-alpha/numnodes.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-alpha/numnodes.h 2003-09-16 00:14:11.000000000 -0700 @@ -1,6 +1,7 @@ #ifndef _ASM_MAX_NUMNODES_H #define _ASM_MAX_NUMNODES_H -#define MAX_NUMNODES 128 /* Marvel */ +/* Max 128 Nodes - Marvel */ +#define NODES_SHIFT 7 #endif /* _ASM_MAX_NUMNODES_H */ diff -puN include/asm-i386/numaq.h~node-enumeration-cleanup-01 include/asm-i386/numaq.h --- 25/include/asm-i386/numaq.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-i386/numaq.h 2003-09-16 00:14:38.000000000 -0700 @@ -28,7 +28,6 @@ #ifdef CONFIG_X86_NUMAQ -#define MAX_NUMNODES 16 extern int get_memcfg_numaq(void); /* diff -puN include/asm-i386/numnodes.h~node-enumeration-cleanup-01 include/asm-i386/numnodes.h --- 25/include/asm-i386/numnodes.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-i386/numnodes.h 2003-09-16 00:15:23.000000000 -0700 @@ -4,11 +4,15 @@ #include #ifdef CONFIG_X86_NUMAQ -#include -#elif CONFIG_ACPI_SRAT -#include -#else -#define MAX_NUMNODES 1 + +/* 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 -puN include/asm-i386/srat.h~node-enumeration-cleanup-01 include/asm-i386/srat.h --- 25/include/asm-i386/srat.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-i386/srat.h 2003-09-16 00:15:40.000000000 -0700 @@ -31,7 +31,6 @@ #error CONFIG_ACPI_SRAT not defined, and srat.h header has been included #endif -#define MAX_NUMNODES 8 extern int get_memcfg_from_srat(void); extern unsigned long *get_zholes_size(int); diff -puN include/asm-ppc64/numnodes.h~node-enumeration-cleanup-01 include/asm-ppc64/numnodes.h --- 25/include/asm-ppc64/numnodes.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-ppc64/numnodes.h 2003-09-16 00:14:11.000000000 -0700 @@ -1,6 +1,7 @@ #ifndef _ASM_MAX_NUMNODES_H #define _ASM_MAX_NUMNODES_H -#define MAX_NUMNODES 16 +/* Max 16 Nodes */ +#define NODES_SHIFT 4 #endif /* _ASM_MAX_NUMNODES_H */ diff -puN include/asm-x86_64/mmzone.h~node-enumeration-cleanup-01 include/asm-x86_64/mmzone.h --- 25/include/asm-x86_64/mmzone.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-x86_64/mmzone.h 2003-09-16 00:14:11.000000000 -0700 @@ -10,7 +10,6 @@ #define VIRTUAL_BUG_ON(x) -#include #include #define MAXNODE 8 diff -puN include/asm-x86_64/numnodes.h~node-enumeration-cleanup-01 include/asm-x86_64/numnodes.h --- 25/include/asm-x86_64/numnodes.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/asm-x86_64/numnodes.h 2003-09-16 00:14:11.000000000 -0700 @@ -3,10 +3,7 @@ #include -#ifdef CONFIG_DISCONTIGMEM -#define MAX_NUMNODES 8 /* APIC limit currently */ -#else -#define MAX_NUMNODES 1 -#endif +/* Max 8 Nodes - APIC limit currently */ +#define NODES_SHIFT 3 #endif diff -puN include/linux/mmzone.h~node-enumeration-cleanup-01 include/linux/mmzone.h --- 25/include/linux/mmzone.h~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/include/linux/mmzone.h 2003-09-16 00:14:11.000000000 -0700 @@ -14,9 +14,10 @@ #ifdef CONFIG_DISCONTIGMEM #include #endif -#ifndef MAX_NUMNODES -#define MAX_NUMNODES 1 +#ifndef NODES_SHIFT +#define NODES_SHIFT 0 #endif +#define MAX_NUMNODES (1 << NODES_SHIFT) /* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER diff -puN mm/slab.c~node-enumeration-cleanup-01 mm/slab.c --- 25/mm/slab.c~node-enumeration-cleanup-01 2003-09-16 00:14:11.000000000 -0700 +++ 25-akpm/mm/slab.c 2003-09-16 00:14:11.000000000 -0700 @@ -250,7 +250,7 @@ struct kmem_cache_s { unsigned int limit; /* 2) touched by every alloc & free from the backend */ struct kmem_list3 lists; - /* NUMA: kmem_3list_t *nodelists[NR_NODES] */ + /* NUMA: kmem_3list_t *nodelists[MAX_NUMNODES] */ unsigned int objsize; unsigned int flags; /* constant flags */ unsigned int num; /* # of objs per slab */ _