Re: [PATCH] mm/page_alloc: simplify lowmem_reserve max calculation
From: Zi Yan
Date: Thu Aug 14 2025 - 10:54:14 EST
On 14 Aug 2025, at 5:00, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> Use max() macro to simplify the calculation of maximum lowmem_reserve
> value in calculate_totalreserve_pages(), instead of open-coding the
> comparison. The functionality remains identical.
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> ---
> mm/page_alloc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 64872214bc7d..8a55a4951d19 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6236,8 +6236,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]);
> }
There is a “if (max > managed_pages)” below. Maybe convert that as well?
Feel free to add Acked-by: Zi Yan <ziy@xxxxxxxxxx>.
Best Regards,
Yan, Zi