From: mel@skynet.ie (Mel Gorman) Usually, a mem_map is aligned on MAX_ORDER_NR_PAGES boundaries and the struct pages are always valid. However, this is not always the case when CONFIG_HOLES_IN_ZONE is set. move_freepages_block() checks that pages within a MAX_ORDER_NR_PAGES block are in the same zone using page_zone(). However, if an invalid page is passed to page_zone(), it can result in breakage on machines requiring CONFIG_HOLES_IN_ZONE. This patch avoids the use of page_zone() and instead checks the PFNs against the PFN ranges of the zone. This fixes a boot problem on IA64 using the config arch/ia64/configs/sn2_defconfig . Credit to Christoph Lameter for testing, reporting the bug and verifying this fixes the problem. Credit to Andy Whitcroft for giving the patch a quick review to ensure no functionality was changed. Signed-off-by: Mel Gorman Cc: Christoph Lameter Cc: Andy Whitcroft Signed-off-by: Andrew Morton --- mm/page_alloc.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff -puN mm/page_alloc.c~move-free-pages-between-lists-on-steal-fix mm/page_alloc.c --- a/mm/page_alloc.c~move-free-pages-between-lists-on-steal-fix +++ a/mm/page_alloc.c @@ -700,18 +700,19 @@ int move_freepages(struct zone *zone, int move_freepages_block(struct zone *zone, struct page *page, int migratetype) { - unsigned long start_pfn; + unsigned long start_pfn, end_pfn; struct page *start_page, *end_page; start_pfn = page_to_pfn(page); start_pfn = start_pfn & ~(MAX_ORDER_NR_PAGES-1); start_page = pfn_to_page(start_pfn); end_page = start_page + MAX_ORDER_NR_PAGES; + end_pfn = start_pfn + MAX_ORDER_NR_PAGES; /* Do not cross zone boundaries */ - if (page_zone(page) != page_zone(start_page)) + if (start_pfn < zone->zone_start_pfn) start_page = page; - if (page_zone(page) != page_zone(end_page)) + if (end_pfn >= zone->zone_start_pfn + zone->spanned_pages) return 0; return move_freepages(zone, start_page, end_page, migratetype); _