From: Ye Liu Date: Thu, 14 Aug 2025 09:00:52 +0000 (+0800) Subject: mm/page_alloc: simplify lowmem_reserve max calculation X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=04cf7ec7ed9f44ddf2b674e8ebbe0087e87708f3;p=users%2Fjedix%2Flinux-maple.git mm/page_alloc: simplify lowmem_reserve max calculation Use max() to find the maximum lowmem_reserve value and min_t() to cap it to managed_pages in calculate_totalreserve_pages(), instead of open-coding the comparisons. No functional change. Link: https://lkml.kernel.org/r/20250814090053.22241-1-ye.liu@linux.dev Signed-off-by: Ye Liu Acked-by: Johannes Weiner Acked-by: Zi Yan Reviewed-by: Wei Yang Cc: Brendan Jackman Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 09241bb7663e..35b2bf61b78d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6237,8 +6237,7 @@ static void calculate_totalreserve_pages(void) /* Find valid and maximum lowmem_reserve in the zone */ for (j = i; j < MAX_NR_ZONES; j++) { - if (zone->lowmem_reserve[j] > max) - max = zone->lowmem_reserve[j]; + max = max(max, zone->lowmem_reserve[j]); } /* we treat the high watermark as reserved pages. */