mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
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>
This commit is contained in:
parent
e1f42a577f
commit
883dd161e9
1 changed files with 4 additions and 1 deletions
|
@ -1335,6 +1335,7 @@ static inline void expand(struct zone *zone, struct page *page,
|
||||||
int low, int high, int migratetype)
|
int low, int high, int migratetype)
|
||||||
{
|
{
|
||||||
unsigned long size = 1 << high;
|
unsigned long size = 1 << high;
|
||||||
|
unsigned long nr_added = 0;
|
||||||
|
|
||||||
while (high > low) {
|
while (high > low) {
|
||||||
high--;
|
high--;
|
||||||
|
@ -1350,9 +1351,11 @@ static inline void expand(struct zone *zone, struct page *page,
|
||||||
if (set_page_guard(zone, &page[size], high))
|
if (set_page_guard(zone, &page[size], high))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
add_to_free_list(&page[size], zone, high, migratetype, false);
|
__add_to_free_list(&page[size], zone, high, migratetype, false);
|
||||||
set_buddy_order(&page[size], high);
|
set_buddy_order(&page[size], high);
|
||||||
|
nr_added += size;
|
||||||
}
|
}
|
||||||
|
account_freepages(zone, nr_added, migratetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_new_page_bad(struct page *page)
|
static void check_new_page_bad(struct page *page)
|
||||||
|
|
Loading…
Reference in a new issue