BACKPORT: mm: page_alloc: batch vmstat updates in expand()
expand() currently updates vmstat for every subpage. This is unnecessary, since they're all of the same zone and migratetype. Count added pages locally, then do a single vmstat update. Link: https://lkml.kernel.org/r/20240327190111.GC7597@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Suggested-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Bug: 406708503 (cherry picked from commit 883dd161e9a83e188487debc562b1928917a4b39) [skipped replacing add_to_free_list with __add_to_free_list, This modification has already been included in 3578319.] Change-Id: I435b8146b68e4b6fb80b88c4a0339aae6ca20cda Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
committed by
Suren Baghdasaryan
parent
3dc7946030
commit
bc1e3097e3
@@ -1516,6 +1516,7 @@ static inline void expand(struct zone *zone, struct page *page,
|
||||
int low, int high, int migratetype)
|
||||
{
|
||||
unsigned long size = 1 << high;
|
||||
unsigned long nr_added = 0;
|
||||
|
||||
while (high > low) {
|
||||
high--;
|
||||
@@ -1533,7 +1534,9 @@ static inline void expand(struct zone *zone, struct page *page,
|
||||
|
||||
__add_to_free_list(&page[size], zone, high, migratetype, false);
|
||||
set_buddy_order(&page[size], high);
|
||||
nr_added += size;
|
||||
}
|
||||
account_freepages(zone, nr_added, migratetype);
|
||||
}
|
||||
|
||||
static void check_new_page_bad(struct page *page)
|
||||
|
Reference in New Issue
Block a user