From 97187b040e11b2a8a194ed29791de9b06e92e264 Mon Sep 17 00:00:00 2001 From: Pengfei Li Date: Mon, 14 Jul 2025 10:28:21 +0800 Subject: [PATCH] ANDROID: mm: Added zone_pageset_high_and_batch_update Added a new function zone_pageset_high_and_batch_update, which is like zone_pcp_update but with new high_min, high_max and batch values provided directly by the caller (rather than returned by zone_highsize). This gives vendors an interface to directly tune the pageset to suit varying loads. Bug: 431672372 Change-Id: Icd1e297f4cfb2309b36caa7f7c61b1c7c7cd9f24 Signed-off-by: Pengfei Li --- include/linux/mm.h | 3 +++ mm/page_alloc.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index f767c5f1b784..62b8f0403498 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4291,6 +4291,9 @@ void vma_pgtable_walk_end(struct vm_area_struct *vma); int reserve_mem_find_by_name(const char *name, phys_addr_t *start, phys_addr_t *size); +void zone_pageset_high_and_batch_update(struct zone *zone, int new_high_min, + int new_high_max, int new_batch); + #ifdef CONFIG_64BIT int do_mseal(unsigned long start, size_t len_in, unsigned long flags); #else diff --git a/mm/page_alloc.c b/mm/page_alloc.c index da3ab3c781f9..01e7586a7e11 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6217,6 +6217,22 @@ static void zone_pcp_update(struct zone *zone, int cpu_online) mutex_unlock(&pcp_batch_high_lock); } +void zone_pageset_high_and_batch_update(struct zone *zone, int new_high_min, + int new_high_max, int new_batch) +{ + mutex_lock(&pcp_batch_high_lock); + + zone->pageset_high_min = new_high_min; + zone->pageset_high_max = new_high_max; + zone->pageset_batch = new_batch; + + __zone_set_pageset_high_and_batch(zone, new_high_min, new_high_max, + new_batch); + + mutex_unlock(&pcp_batch_high_lock); +} +EXPORT_SYMBOL_GPL(zone_pageset_high_and_batch_update); + static void zone_pcp_update_cacheinfo(struct zone *zone, unsigned int cpu) { struct per_cpu_pages *pcp;