--- include/linux/mmzone.h | 21 +++++++++++++++++++++ mm/page_alloc.c | 13 ++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) Index: linux-2.6/include/linux/mmzone.h =================================================================== --- linux-2.6.orig/include/linux/mmzone.h 2007-09-12 08:51:02.000000000 -0700 +++ linux-2.6/include/linux/mmzone.h 2007-09-12 08:57:44.000000000 -0700 @@ -37,6 +37,21 @@ struct free_area { unsigned long nr_free; }; +/* + * Detached memory segment only used for higher order allocations + * + * The segment may be shared between zones and nodes and the + * pfn range may be outside of zone boundaries if the pages in a pool are so + * large that they cover multiple nodes/zones. + */ +struct page_pool { + spinlock_t lock; + struct list_head free_list; + int nr_free; + unsigned long pfn_start; + unsigned long pfn_end; +}; + struct pglist_data; /* @@ -222,6 +237,12 @@ struct zone { #endif struct free_area free_area[MAX_ORDER]; +#ifdef CONFIG_PAGE_POOL + unsigned long pool_pages_avail; + struct page_pool *pool[MAX_PHYSMEM_BITS - PAGE_SHIFT - 2]; +#endif + + ZONE_PADDING(_pad1_) Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c 2007-09-12 08:57:53.000000000 -0700 +++ linux-2.6/mm/page_alloc.c 2007-09-12 09:02:51.000000000 -0700 @@ -405,8 +405,13 @@ static inline void __free_one_page(struc unsigned long page_idx; int order_size = 1 << order; - if (unlikely(PageHead(page))) + if (unlikely(PageHead(page))) { + if (pagepool_page(page)) { + pool_free_page(zone, order, page); + return; + } destroy_compound_page(page, order); + } page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1); @@ -1190,6 +1195,12 @@ zonelist_scan: !cpuset_zone_allowed_softwall(zone, gfp_mask)) goto try_next_zone; + if (unlikely(bit_set(order, zone->available_pagepools))) { + page = pool_alloc_page(zone, order); + if (page) + break; + } + if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { unsigned long mark; if (alloc_flags & ALLOC_WMARK_MIN)