Skip to content

Commit 5576646

Browse files
akpm00torvalds
authored andcommitted
revert "mm: fix-up zone present pages"
Revert commit 7f1290f ("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>
1 parent 0f3c42f commit 5576646

File tree

6 files changed

+1
-58
lines changed

6 files changed

+1
-58
lines changed

arch/ia64/mm/init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ mem_init (void)
637637

638638
high_memory = __va(max_low_pfn * PAGE_SIZE);
639639

640-
reset_zone_present_pages();
641640
for_each_online_pgdat(pgdat)
642641
if (pgdat->bdata->node_bootmem_map)
643642
totalram_pages += free_all_bootmem_node(pgdat);

include/linux/mm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,9 +1684,5 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
16841684
static inline bool page_is_guard(struct page *page) { return false; }
16851685
#endif /* CONFIG_DEBUG_PAGEALLOC */
16861686

1687-
extern void reset_zone_present_pages(void);
1688-
extern void fixup_zone_present_pages(int nid, unsigned long start_pfn,
1689-
unsigned long end_pfn);
1690-
16911687
#endif /* __KERNEL__ */
16921688
#endif /* _LINUX_MM_H */

mm/bootmem.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
198198
int order = ilog2(BITS_PER_LONG);
199199

200200
__free_pages_bootmem(pfn_to_page(start), order);
201-
fixup_zone_present_pages(page_to_nid(pfn_to_page(start)),
202-
start, start + BITS_PER_LONG);
203201
count += BITS_PER_LONG;
204202
start += BITS_PER_LONG;
205203
} else {
@@ -210,9 +208,6 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
210208
if (vec & 1) {
211209
page = pfn_to_page(start + off);
212210
__free_pages_bootmem(page, 0);
213-
fixup_zone_present_pages(
214-
page_to_nid(page),
215-
start + off, start + off + 1);
216211
count++;
217212
}
218213
vec >>= 1;
@@ -226,11 +221,8 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
226221
pages = bdata->node_low_pfn - bdata->node_min_pfn;
227222
pages = bootmem_bootmap_pages(pages);
228223
count += pages;
229-
while (pages--) {
230-
fixup_zone_present_pages(page_to_nid(page),
231-
page_to_pfn(page), page_to_pfn(page) + 1);
224+
while (pages--)
232225
__free_pages_bootmem(page++, 0);
233-
}
234226

235227
bdebug("nid=%td released=%lx\n", bdata - bootmem_node_data, count);
236228

mm/memory_hotplug.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ static void get_page_bootmem(unsigned long info, struct page *page,
106106
void __ref put_page_bootmem(struct page *page)
107107
{
108108
unsigned long type;
109-
struct zone *zone;
110109

111110
type = (unsigned long) page->lru.next;
112111
BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||
@@ -117,12 +116,6 @@ void __ref put_page_bootmem(struct page *page)
117116
set_page_private(page, 0);
118117
INIT_LIST_HEAD(&page->lru);
119118
__free_pages_bootmem(page, 0);
120-
121-
zone = page_zone(page);
122-
zone_span_writelock(zone);
123-
zone->present_pages++;
124-
zone_span_writeunlock(zone);
125-
totalram_pages++;
126119
}
127120

128121
}

mm/nobootmem.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ static unsigned long __init __free_memory_core(phys_addr_t start,
116116
return 0;
117117

118118
__free_pages_memory(start_pfn, end_pfn);
119-
fixup_zone_present_pages(pfn_to_nid(start >> PAGE_SHIFT),
120-
start_pfn, end_pfn);
121119

122120
return end_pfn - start_pfn;
123121
}
@@ -128,7 +126,6 @@ unsigned long __init free_low_memory_core_early(int nodeid)
128126
phys_addr_t start, end, size;
129127
u64 i;
130128

131-
reset_zone_present_pages();
132129
for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL)
133130
count += __free_memory_core(start, end);
134131

mm/page_alloc.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6098,37 +6098,3 @@ void dump_page(struct page *page)
60986098
dump_page_flags(page->flags);
60996099
mem_cgroup_print_bad_page(page);
61006100
}
6101-
6102-
/* reset zone->present_pages */
6103-
void reset_zone_present_pages(void)
6104-
{
6105-
struct zone *z;
6106-
int i, nid;
6107-
6108-
for_each_node_state(nid, N_HIGH_MEMORY) {
6109-
for (i = 0; i < MAX_NR_ZONES; i++) {
6110-
z = NODE_DATA(nid)->node_zones + i;
6111-
z->present_pages = 0;
6112-
}
6113-
}
6114-
}
6115-
6116-
/* calculate zone's present pages in buddy system */
6117-
void fixup_zone_present_pages(int nid, unsigned long start_pfn,
6118-
unsigned long end_pfn)
6119-
{
6120-
struct zone *z;
6121-
unsigned long zone_start_pfn, zone_end_pfn;
6122-
int i;
6123-
6124-
for (i = 0; i < MAX_NR_ZONES; i++) {
6125-
z = NODE_DATA(nid)->node_zones + i;
6126-
zone_start_pfn = z->zone_start_pfn;
6127-
zone_end_pfn = zone_start_pfn + z->spanned_pages;
6128-
6129-
/* if the two regions intersect */
6130-
if (!(zone_start_pfn >= end_pfn || zone_end_pfn <= start_pfn))
6131-
z->present_pages += min(end_pfn, zone_end_pfn) -
6132-
max(start_pfn, zone_start_pfn);
6133-
}
6134-
}

0 commit comments

Comments
 (0)