Re: [PATCH v4] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write
Jianlin Shi <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 3 Aug 2026 17:48:17 -0700 Andrew Morton wrote:
> I find this a little tidier:
>
> --- a/mm/page_alloc.c~mm-page_alloc-only-update-lowmem_reserve_ratio-on-sysctl-write-fix
> +++ a/mm/page_alloc.c
> @@ -6926,7 +6926,7 @@ static int lowmem_reserve_ratio_sysctl_h
> int write, void *buffer, size_t *length, loff_t *ppos)
> {
> struct ctl_table tmp = *table;
> - int ratio[MAX_NR_ZONES];
> + int ratio[ARRAY_SIZE(sysctl_lowmem_reserve_ratio)];
> int rc;
>
> if (!write)
>
> A bit more self-documenting and future-proof. What do you think?
Agreed, that is nicer. The temporary buffer is meant to mirror
sysctl_lowmem_reserve_ratio[], so sizing it with ARRAY_SIZE() makes
that relationship clearer than MAX_NR_ZONES.
I'll fold it into v5 and send shortly.
Thanks,
Jianlin