Skip to contentSkip to conversation

mm/page_alloc: Fix incorrect PGFREE and PGALLOC for high-order page

PATCH Applied Yafang Shao 3 participants 3 messages Oct 6, 2022 – Oct 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_alloc: Fix incorrect PGFREE and PGALLOC for high-order page

PGFREE and PGALLOC represent the number of freed and allocated pages. So the page order must be considered.

Fixes 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
Cc Mel Gorman <[email protected]>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_alloc.c +2 -2
index e5486d4..3c0ee3b 100644
@@ -3440,7 +3440,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp,
 	int pindex;
 	bool free_high;
 
-	__count_vm_event(PGFREE);
+	__count_vm_events(PGFREE, 1 << order);
 	pindex = order_to_pindex(migratetype, order);
 	list_add(&page->pcp_list, &pcp->lists[pindex]);
 	pcp->count += 1 << order;
@@ -3808,7 +3808,7 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone,
 	pcp_spin_unlock_irqrestore(pcp, flags);
 	pcp_trylock_finish(UP_flags);
 	if (page) {
-		__count_zid_vm_events(PGALLOC, page_zonenum(page), 1);
+		__count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
 		zone_statistics(preferred_zone, zone, 1);
 	}
 	return page;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Yafang Shao
Quoted 5 lines · Yafang Shao

PGFREE and PGALLOC represent the number of freed and allocated pages. So the page order must be considered.

Fixes 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")

LGTM. Thanks for fixing.

Thanks,
Miaohe Lin

Quoted 28 lines
Cc Mel Gorman <[email protected]>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_alloc.c +2 -2
index e5486d4..3c0ee3b 100644
@@ -3440,7 +3440,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp,
 	int pindex;
 	bool free_high;
 
-	__count_vm_event(PGFREE);
+	__count_vm_events(PGFREE, 1 << order);
 	pindex = order_to_pindex(migratetype, order);
 	list_add(&page->pcp_list, &pcp->lists[pindex]);
 	pcp->count += 1 << order;
@@ -3808,7 +3808,7 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone,
 	pcp_spin_unlock_irqrestore(pcp, flags);
 	pcp_trylock_finish(UP_flags);
 	if (page) {
-		__count_zid_vm_events(PGALLOC, page_zonenum(page), 1);
+		__count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
 		zone_statistics(preferred_zone, zone, 1);
 	}
 	return page;