Re: [PATCH v3] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write

From: Vlastimil Babka (SUSE)

Date: Mon Aug 03 2026 - 04:28:50 EST


+Cc: sysctl maintainers

On 8/1/26 20:44, Andrew Morton wrote:
> On Sat, 1 Aug 2026 23:11:25 +0800 Jianlin Shi <shijianlin11@xxxxxxxxxxx> wrote:
>
>> lowmem_reserve_ratio_sysctl_handler() ignores the return value of
>> proc_dointvec_minmax() and always calls setup_per_zone_lowmem_reserve(),
>> even for read operations.
>>
>> Fix two issues:
>>
>> 1. Propagate errors from proc_dointvec_minmax() instead of always
>> returning success. For example, writing non-integer garbage to the
>> sysctl now returns an error instead of silently succeeding with
>> unchanged values.
>
> AI review suggest that this caused a new problem:
>
> https://sashiko.dev/#/patchset/tencent_1BB7A5C4D5EEA67346634417753190E92A09@xxxxxx
>
> Not sure what to do here. Perhaps pass proc_dointvec_minmax() a
> temporary then copy that into sysctl_lowmem_reserve_ratio if all
> proc_dointvec_minmax() returns "OK".

Seeing the v4 [1] it seems easier to keep the current fixup code until
proc_dointvec_minmax() is fixed.

> But really this is a flaw in proc_dointvec_minmax() isn't it? It
> shouldn't update the table data until all the data has been validated.

I agree. What do the maintainers think?

[1]
https://lore.kernel.org/all/tencent_B9556590D4B65ACF74C06897689A6E39F206@xxxxxx/