From: Jiang Liu Date: Fri, 9 Nov 2012 03:03:42 +0000 (+1100) Subject: mm: fix a regression with HIGHMEM X-Git-Tag: next-20121113~6^2~297 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=66d4712ac06d1f5fdc3106d75b05261aabb28f91;p=karo-tx-linux.git mm: fix a regression with HIGHMEM Changeset 7f1290f2f2 ("mm: fix-up zone present pages") tried to fix a issue when calculating zone->present_pages, but it causes a regression to 32bit systems with HIGHMEM. With that changeset, reset_zone_present_pages() resets all zone->present_pages to zero, and fixup_zone_present_pages() is called to recalculate zone->present_pages when the boot allocator frees core memory pages into the buddy allocator. Because highmem pages are not freed by bootmem allocator, all highmem zones' present_pages becomes zero. Actually there's no need to recalculate present_pages for the highmem zone because the bootmem allocator never allocates pages from it. So fix the regression by skipping highmem in function reset_zone_present_pages() and fixup_zone_present_pages(). Signed-off-by: Jiang Liu Signed-off-by: Jianguo Wu Reported-by: Maciej Rutecki Tested-by: Maciej Rutecki Tested-by: Chris Clayton Cc: Rafael J. Wysocki Cc: Mel Gorman Cc: Minchan Kim Cc: KAMEZAWA Hiroyuki Cc: Michal Hocko Signed-off-by: Andrew Morton --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5b74de6702e0..2311f1585744 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6108,7 +6108,8 @@ void reset_zone_present_pages(void) for_each_node_state(nid, N_HIGH_MEMORY) { for (i = 0; i < MAX_NR_ZONES; i++) { z = NODE_DATA(nid)->node_zones + i; - z->present_pages = 0; + if (!is_highmem(z)) + z->present_pages = 0; } } } @@ -6123,10 +6124,11 @@ void fixup_zone_present_pages(int nid, unsigned long start_pfn, for (i = 0; i < MAX_NR_ZONES; i++) { z = NODE_DATA(nid)->node_zones + i; + if (is_highmem(z)) + continue; + zone_start_pfn = z->zone_start_pfn; zone_end_pfn = zone_start_pfn + z->spanned_pages; - - /* if the two regions intersect */ if (!(zone_start_pfn >= end_pfn || zone_end_pfn <= start_pfn)) z->present_pages += min(end_pfn, zone_end_pfn) - max(start_pfn, zone_start_pfn);