This should make the header a bit more maintainable. Signed-off-by: Dave Hansen --- memhotplug-dave/include/linux/mmzone.h | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff -puN include/linux/mmzone.h~A4.1-refactor-sparsemem-constants-for-extreme include/linux/mmzone.h --- memhotplug/include/linux/mmzone.h~A4.1-refactor-sparsemem-constants-for-extreme 2005-07-28 13:50:14.000000000 -0700 +++ memhotplug-dave/include/linux/mmzone.h 2005-07-28 13:50:14.000000000 -0700 @@ -488,17 +488,20 @@ struct mem_section { }; #ifdef CONFIG_ARCH_SPARSEMEM_EXTREME -/* - * Should we ever require GCC 4 or later then the flat array scheme - * can be eliminated and a uniform solution for EXTREME and !EXTREME can - * be arrived at. - */ -#define SECTION_ROOT_SHIFT (PAGE_SHIFT-3) -#define SECTION_ROOT_MASK ((1UL<> SECTION_ROOT_SHIFT) -#define NR_SECTION_ROOTS (NR_MEM_SECTIONS >> SECTION_ROOT_SHIFT) +#define SECTIONS_PER_ROOT (PAGE_SIZE / sizeof (struct mem_section)) +#else +#define SECTIONS_PER_ROOT 1 +#endif +#define SECTION_TO_ROOT(_sec) ((_sec) / SECTIONS_PER_ROOT) +#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT) +#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) + +#ifdef CONFIG_ARCH_SPARSEMEM_EXTREME extern struct mem_section *mem_section[NR_SECTION_ROOTS]; +#else +extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; +#endif static inline struct mem_section *__nr_to_section(unsigned long nr) { _