revert "mm: fix-up zone present pages"
Revert commit 7f1290f2f2
("mm: fix-up zone present pages")
That patch tried to fix a issue when calculating zone->present_pages,
but it caused a regression on 32bit systems with HIGHMEM. With that
change, 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
buddy allocator. Because highmem pages are not freed by bootmem
allocator, all highmem zones' present_pages becomes zero.
Various options for improving the situation are being discussed but for
now, let's return to the 3.6 code.
Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Petr Tesarik <ptesarik@suse.cz>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: David Rientjes <rientjes@google.com>
Tested-by: Chris Clayton <chris2553@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
0f3c42f522
commit
5576646f3c
@@ -6098,37 +6098,3 @@ void dump_page(struct page *page)
|
||||
dump_page_flags(page->flags);
|
||||
mem_cgroup_print_bad_page(page);
|
||||
}
|
||||
|
||||
/* reset zone->present_pages */
|
||||
void reset_zone_present_pages(void)
|
||||
{
|
||||
struct zone *z;
|
||||
int i, nid;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate zone's present pages in buddy system */
|
||||
void fixup_zone_present_pages(int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn)
|
||||
{
|
||||
struct zone *z;
|
||||
unsigned long zone_start_pfn, zone_end_pfn;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_NR_ZONES; i++) {
|
||||
z = NODE_DATA(nid)->node_zones + i;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user