Index: linux-2.6.20-mm2/include/linux/mm_types.h =================================================================== --- linux-2.6.20-mm2.orig/include/linux/mm_types.h 2007-02-20 21:44:38.000000000 -0800 +++ linux-2.6.20-mm2/include/linux/mm_types.h 2007-02-20 22:16:16.000000000 -0800 @@ -16,8 +16,17 @@ struct address_space; * who is mapping it. */ struct page { - unsigned long flags; /* Atomic flags, some possibly + u32 flags; /* Atomic flags, some possibly * updated asynchronously */ +#ifdef CONFIG_64BIT + unsigned int zone:2; + unsigned int node:10; + unsigned int on_lru:1; + unsigned int active:1; + unsigned int mlocked:1; + unsigned int swapcache:1; + u16 section; +#endif atomic_t _count; /* Usage count, see below. */ atomic_t _mapcount; /* Count of ptes mapped in mms, * to show when page is mapped Index: linux-2.6.20-mm2/include/linux/mm.h =================================================================== --- linux-2.6.20-mm2.orig/include/linux/mm.h 2007-02-20 21:48:52.000000000 -0800 +++ linux-2.6.20-mm2/include/linux/mm.h 2007-02-20 22:05:00.000000000 -0800 @@ -380,7 +380,22 @@ static inline compound_page_dtor *get_co * The zone field is never updated after free_area_init_core() * sets it, so none of the operations on it need to be atomic. */ +#ifndef PFN_SECTION_SHIFT +#define PFN_SECTION_SHIFT 0 +#endif + + +#ifdef CONFIG_64BIT +#define page_zonenum(__p) (__p)->zone +#define page_to_nid(__p) (__p)->node +#define page_zone_id(__p) (page_zonenum(__p) + (page_to_nid(__p) << 2)) +#define page_to_section(__p) (__p)->section + +#define set_page_zone(__p,__zone) ((__p)->zone = (__zone)) +#define set_page_node(__p,__node) ((__p)->node = (__node)) +#define set_page_section(__p, __section) ((__p)->section = (__section)) +#else /* * page->flags layout: @@ -423,10 +438,6 @@ static inline compound_page_dtor *get_co #define NODE_NOT_IN_PAGE_FLAGS #endif -#ifndef PFN_SECTION_SHIFT -#define PFN_SECTION_SHIFT 0 -#endif - /* * Define the bit shifts to access each section. For non-existant * sections we define the shift as 0; that plus a 0 mask ensures @@ -476,15 +487,6 @@ static inline int page_zone_id(struct pa return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; } -static inline int zone_to_nid(struct zone *zone) -{ -#ifdef CONFIG_NUMA - return zone->node; -#else - return 0; -#endif -} - #ifdef NODE_NOT_IN_PAGE_FLAGS extern int page_to_nid(struct page *page); #else @@ -494,11 +496,6 @@ static inline int page_to_nid(struct pag } #endif -static inline struct zone *page_zone(struct page *page) -{ - return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; -} - static inline unsigned long page_to_section(struct page *page) { return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; @@ -521,6 +518,22 @@ static inline void set_page_section(stru page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; } +#endif + +static inline int zone_to_nid(struct zone *zone) +{ +#ifdef CONFIG_NUMA + return zone->node; +#else + return 0; +#endif +} + +static inline struct zone *page_zone(struct page *page) +{ + return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; +} + static inline void set_page_links(struct page *page, enum zone_type zone, unsigned long node, unsigned long pfn) Index: linux-2.6.20-mm2/include/linux/page-flags.h =================================================================== --- linux-2.6.20-mm2.orig/include/linux/page-flags.h 2007-02-20 22:06:08.000000000 -0800 +++ linux-2.6.20-mm2/include/linux/page-flags.h 2007-02-20 22:12:18.000000000 -0800 @@ -147,6 +147,38 @@ static inline void SetPageUptodate(struc #define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags) #define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) +#ifdef CONFIG_64BIT +#define PageLRU(page) page->on_lru +#define SetPageLRU(page) page->on_lru = 1 +#define ClearPageLRU(page) page->on_lru = 0 +#define __ClearPageLRU(page) page->on_lru = 0 + +#define PageActive(page) page->active +#define SetPageActive(page) page->active = 1 +#define ClearPageActive(page) page->active = 0 +#define __ClearPageActive(page) page->active = 0 + +/* + * PageMlocked set means that the page was taken off the LRU because + * a VM_LOCKED vma does exist. PageMlocked must be cleared before a + * page is put back onto the LRU. PageMlocked is only modified + * under the zone->lru_lock like PageLRU. + */ +#define PageMlocked(page) page->mlocked +#define SetPageMlocked(page) page->mlocked = 1 +#define ClearPageMlocked(page) page->mlocked = 0 +#define __ClearPageMlocked(page) page->mlocked = 0 + +#ifdef CONFIG_SWAP +#define PageSwapCache(page) page->swapcache +#define SetPageSwapCache(page) page->swapcache = 1 +#define ClearPageSwapCache(page) page->swapcache = 0 +#else +#define PageSwapCache(page) 0 +#endif + + +#else #define PageLRU(page) test_bit(PG_lru, &(page)->flags) #define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) #define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags) @@ -157,6 +189,21 @@ static inline void SetPageUptodate(struc #define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) #define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags) +#define PageMlocked(page) test_bit(PG_mlocked, &(page)->flags) +#define SetPageMlocked(page) set_bit(PG_mlocked, &(page)->flags) +#define ClearPageMlocked(page) clear_bit(PG_mlocked, &(page)->flags) +#define __ClearPageMlocked(page) __clear_bit(PG_mlocked, &(page)->flags) + +#ifdef CONFIG_SWAP +#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags) +#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags) +#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags) +#else +#define PageSwapCache(page) 0 +#endif + +#endif + #define PageSlab(page) test_bit(PG_slab, &(page)->flags) #define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags) #define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags) @@ -219,29 +266,10 @@ static inline void SetPageUptodate(struc #define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags) #define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags) -#ifdef CONFIG_SWAP -#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags) -#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags) -#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags) -#else -#define PageSwapCache(page) 0 -#endif - #define PageUncached(page) test_bit(PG_uncached, &(page)->flags) #define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags) #define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags) -/* - * PageMlocked set means that the page was taken off the LRU because - * a VM_LOCKED vma does exist. PageMlocked must be cleared before a - * page is put back onto the LRU. PageMlocked is only modified - * under the zone->lru_lock like PageLRU. - */ -#define PageMlocked(page) test_bit(PG_mlocked, &(page)->flags) -#define SetPageMlocked(page) set_bit(PG_mlocked, &(page)->flags) -#define ClearPageMlocked(page) clear_bit(PG_mlocked, &(page)->flags) -#define __ClearPageMlocked(page) __clear_bit(PG_mlocked, &(page)->flags) - #define PageReadahead(page) test_bit(PG_readahead, &(page)->flags) #define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags) #define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)