--- include/linux/mm.h | 10 +++++----- include/linux/mmzone.h | 19 ------------------- include/linux/page-flags.h | 11 ++++++++++- mm/Kconfig | 7 +++++++ mm/page_alloc.c | 1 + mm/sparse.c | 3 +++ 6 files changed, 26 insertions(+), 25 deletions(-) Index: linux-2.6/include/linux/mm.h =================================================================== --- linux-2.6.orig/include/linux/mm.h 2008-02-17 21:13:02.000000000 -0800 +++ linux-2.6/include/linux/mm.h 2008-02-17 21:15:18.000000000 -0800 @@ -388,11 +388,11 @@ static inline void set_compound_order(st * we have run out of space and have to fall back to an * alternate (slower) way of determining the node. * - * No sparsemem: | NODE | ZONE | ... | FLAGS | + * No sparsemem or vmemmap: | NODE | ZONE | ... | FLAGS | * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | * no space for node: | SECTION | ZONE | ... | FLAGS | */ -#ifdef CONFIG_SPARSEMEM +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) #define SECTIONS_WIDTH SECTIONS_SHIFT #else #define SECTIONS_WIDTH 0 @@ -400,7 +400,7 @@ static inline void set_compound_order(st #define ZONES_WIDTH ZONES_SHIFT -#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED +#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS #define NODES_WIDTH NODES_SHIFT #else #define NODES_WIDTH 0 @@ -445,8 +445,8 @@ static inline void set_compound_order(st #define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) -#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED -#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED +#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS +#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS #endif #define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) Index: linux-2.6/include/linux/mmzone.h =================================================================== --- linux-2.6.orig/include/linux/mmzone.h 2008-02-17 21:13:02.000000000 -0800 +++ linux-2.6/include/linux/mmzone.h 2008-02-17 21:15:18.000000000 -0800 @@ -735,25 +735,6 @@ extern struct zone *next_zone(struct zon #include #endif -#if BITS_PER_LONG == 32 -/* - * with 32 bit page->flags field, we reserve 9 bits for node/zone info. - * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes. - */ -#define FLAGS_RESERVED 9 - -#elif BITS_PER_LONG == 64 -/* - * with 64 bit flags field, there's plenty of room. - */ -#define FLAGS_RESERVED 32 - -#else - -#error BITS_PER_LONG not defined - -#endif - #if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ !defined(CONFIG_ARCH_POPULATES_NODE_MAP) #define early_pfn_to_nid(nid) (0UL) Index: linux-2.6/include/linux/page-flags.h =================================================================== --- linux-2.6.orig/include/linux/page-flags.h 2008-02-17 21:14:08.000000000 -0800 +++ linux-2.6/include/linux/page-flags.h 2008-02-17 21:15:28.000000000 -0800 @@ -90,9 +90,18 @@ enum pageflags { #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR PG_uncached, /* Page has been mapped as uncached */ #endif - NR_PAGEFLAGS /* For verification purposes */ + __NR_PAGEFLAGS /* For verification purposes */ }; +#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR +#define FLAGS_IA64 1 +#else +#define FLAGS_IA64 0 +#endif + +#define FLAGS_NORMAL 18 +#define NR_PAGEFLAGS (FLAGS_NORMAL + FLAGS_IA64) + struct page; /* forward declaration */ /* Index: linux-2.6/mm/Kconfig =================================================================== --- linux-2.6.orig/mm/Kconfig 2008-02-17 21:13:02.000000000 -0800 +++ linux-2.6/mm/Kconfig 2008-02-17 21:15:18.000000000 -0800 @@ -190,6 +190,13 @@ config NR_QUICK default "2" if SUPERH default "1" +# +# Regular sparsemem consumes a lot of page flags +# +config EXTENDED_PAGE_FLAGS + bool + depends on SPARSEMEM_VMEMMAP || !SPARSEMEM + config VIRT_TO_BUS def_bool y depends on !ARCH_NO_VIRT_TO_BUS Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c 2008-02-17 21:15:03.000000000 -0800 +++ linux-2.6/mm/page_alloc.c 2008-02-17 21:15:18.000000000 -0800 @@ -3904,6 +3904,7 @@ static int __init cmdline_parse_core(cha if (!p) return -EINVAL; + BUILD_BUG_ON(NR_PAGEFLAGS != __NR_PAGEFLAGS); coremem = memparse(p, &p); *core = coremem >> PAGE_SHIFT; Index: linux-2.6/mm/sparse.c =================================================================== --- linux-2.6.orig/mm/sparse.c 2008-02-17 21:13:02.000000000 -0800 +++ linux-2.6/mm/sparse.c 2008-02-17 21:15:18.000000000 -0800 @@ -27,6 +27,9 @@ struct mem_section mem_section[NR_SECTIO EXPORT_SYMBOL(mem_section); #ifdef NODE_NOT_IN_PAGE_FLAGS +#ifdef CONFIG_SPARSEMEM_VMEMMAP +#error SPARSEMEM_VMEMMAP must have the node in page flags +#endif /* * If we did not store the node number in the page then we have to * do a lookup in the section_to_node_table in order to find which