--- include/linux/bounds.h | 3 +++ include/linux/mm.h | 37 ++++++++++++++++++++++++------------- include/linux/mm_types.h | 19 ++++++++++++++++++- kernel/bounds.c | 4 ++++ 4 files changed, 49 insertions(+), 14 deletions(-) Index: linux-2.6.25-rc8-mm2/include/linux/bounds.h =================================================================== --- linux-2.6.25-rc8-mm2.orig/include/linux/bounds.h 2008-04-17 22:42:21.989889710 -0700 +++ linux-2.6.25-rc8-mm2/include/linux/bounds.h 2008-04-17 22:58:49.681139958 -0700 @@ -9,5 +9,8 @@ #define NR_PAGEFLAGS 19 /* __NR_PAGEFLAGS # */ #define MAX_NR_ZONES 4 /* __MAX_NR_ZONES # */ +#define ZONE_BITS 2 /* ZONES_WIDTH # */ +#define NODE_BITS 0 /* NODES_WIDTH # */ +#define SECTION_BITS 0 /* SECTIONS_WIDTH # */ #endif Index: linux-2.6.25-rc8-mm2/include/linux/mm.h =================================================================== --- linux-2.6.25-rc8-mm2.orig/include/linux/mm.h 2008-04-17 22:50:06.171139964 -0700 +++ linux-2.6.25-rc8-mm2/include/linux/mm.h 2008-04-17 22:58:48.354922058 -0700 @@ -485,7 +485,7 @@ static inline void set_compound_order(st static inline enum zone_type page_zonenum(struct page *page) { - return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; + return page->zonenum; } /* @@ -498,7 +498,7 @@ static inline enum zone_type page_zonenu */ static inline int page_zone_id(struct page *page) { - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; + return page->zoneid; } static inline int zone_to_nid(struct zone *zone) @@ -515,38 +515,49 @@ extern int page_to_nid(struct page *page #else static inline int page_to_nid(struct page *page) { - return (page->flags >> NODES_PGSHIFT) & NODES_MASK; +#ifdef CONFIG_NUMA + return page->node; +#else + return 0; +#endif } #endif static inline struct zone *page_zone(struct page *page) { - return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; + return &NODE_DATA(page->node)->node_zones[page_zonenum(page)]; } -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) static inline unsigned long page_to_section(struct page *page) { - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) + return page->section; +#else + return 0; #endif +} static inline void set_page_zone(struct page *page, enum zone_type zone) { - page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); - page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; + page->zonenum = zone; } static inline void set_page_node(struct page *page, unsigned long node) { - page->flags &= ~(NODES_MASK << NODES_PGSHIFT); - page->flags |= (node & NODES_MASK) << NODES_PGSHIFT; +#ifdef CONFIG_NUMA + page->node - node; +#else + VM_BUG_ON(node); +#endif } static inline void set_page_section(struct page *page, unsigned long section) { - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +#ifdef CONFIG_SECTION_IN_PAGEFLAGS + page->section = section; +#else + VM_BUG_ON(section); +#endif } static inline void set_page_links(struct page *page, enum zone_type zone, Index: linux-2.6.25-rc8-mm2/include/linux/mm_types.h =================================================================== --- linux-2.6.25-rc8-mm2.orig/include/linux/mm_types.h 2008-04-17 22:29:49.599899594 -0700 +++ linux-2.6.25-rc8-mm2/include/linux/mm_types.h 2008-04-17 22:54:30.559899574 -0700 @@ -34,8 +34,25 @@ typedef unsigned long mm_counter_t; * who is mapping it. */ struct page { - unsigned long flags; /* Atomic flags, some possibly + union { + unsigned long flags; /* Atomic flags, some possibly * updated asynchronously */ + struct { + unsigned long flags: NR_PAGEFLAGS; + unsigned long fill: BITS_PER_LONG - ZONE_BITS - NODE_BITS - SECTION_BITS - NR_PAGEFLAGS; + unsigned long zonenum: ZONE_BITS; +#if NODE_BITS + unsigned long node: NODE_BITS; +#endif +#if SECTION_BITS + unsigned long section: SECTION_BITS; +#endif + }; + struct { + unsigned long fill: BITS_PER_LONG - SECTION_BITS - ZONE_BITS - NODE_BITS; + unsigned long zoneid: ZONE_BITS + NODE_BITS; + }; + }; atomic_t _count; /* Usage count, see below. */ union { atomic_t _mapcount; /* Count of ptes mapped in mms, Index: linux-2.6.25-rc8-mm2/kernel/bounds.c =================================================================== --- linux-2.6.25-rc8-mm2.orig/kernel/bounds.c 2008-04-17 22:39:13.399890816 -0700 +++ linux-2.6.25-rc8-mm2/kernel/bounds.c 2008-04-17 22:45:56.169898905 -0700 @@ -4,6 +4,7 @@ * to extract and format the required data. */ +#include #define __GENERATING_BOUNDS_H /* Include headers that define the enum constants of interest */ #include @@ -15,5 +16,8 @@ void foo(void) /* The enum constants to put into include/linux/bounds.h */ DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS); DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES); + DEFINE(ZONE_BITS, ZONES_WIDTH); + DEFINE(NODE_BITS, NODES_WIDTH); + DEFINE(SECTION_BITS, SECTIONS_WIDTH); /* End of constants */ }