From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Jianlin Shi <shijianlin11@foxmail.com>, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, surenb@google.com,
mhocko@suse.com, jackmanb@google.com, ziy@nvidia.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write
Date: Fri, 7 Aug 2026 12:05:53 +0200 [thread overview]
Message-ID: <2fcfa480-e4dd-477f-9c02-42756f3aa373@kernel.org> (raw)
In-Reply-To: <tencent_A860C873956A52E26AD8D309A308A241BA08@qq.com>
On 8/6/26 10:27, Jianlin Shi 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 three 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.
>
> 2. Only call setup_per_zone_lowmem_reserve() when the sysctl is
> actually written, matching the write-only refresh pattern of
> min_free_kbytes and watermark_scale_factor handlers.
>
> 3. On write, parse into a temporary ratio[] array and only copy into
> sysctl_lowmem_reserve_ratio[] and refresh derived state after the
> full vector is validated. This avoids leaving the ratio array
> partially updated while skipping setup when proc_dointvec_minmax()
> returns an error on a later element (suggested by Andrew Morton).
>
> Drop the manual "< 1 -> 0" sanitization loop and set .extra1 =
> SYSCTL_ZERO on the ctl_table entry so proc_dointvec_minmax() enforces
> the minimum on write; negative values now return -EINVAL instead of
> being silently coerced to 0 (suggested by Vlastimil Babka).
>
> Link: https://lore.kernel.org/linux-mm/tencent_FFD4F4D728AAE8A8AE0AF277A59854A29A06@qq.com/
>
> Signed-off-by: Jianlin Shi <shijianlin11@foxmail.com>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
prev parent reply other threads:[~2026-08-07 10:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 10:32 [PATCH] " Jianlin Shi
2026-07-30 15:28 ` Vlastimil Babka (SUSE)
2026-07-31 3:36 ` Jianlin Shi
2026-07-31 3:42 ` [PATCH v2] " Jianlin Shi
2026-07-31 8:06 ` Vlastimil Babka (SUSE)
2026-08-01 7:36 ` Johannes Weiner
2026-08-01 15:11 ` [PATCH v3] " Jianlin Shi
2026-08-01 18:44 ` Andrew Morton
2026-08-02 14:31 ` Jianlin Shi
2026-08-03 8:27 ` Vlastimil Babka (SUSE)
2026-08-04 12:20 ` Joel Granados
2026-08-04 14:33 ` Vlastimil Babka (SUSE)
2026-08-06 8:27 ` Joel Granados
2026-08-02 14:57 ` [PATCH v4] " Jianlin Shi
2026-08-04 0:48 ` Andrew Morton
2026-08-06 7:32 ` Jianlin Shi
2026-08-06 8:27 ` [PATCH v5] " Jianlin Shi
2026-08-06 13:50 ` Johannes Weiner
2026-08-06 21:20 ` Andrew Morton
2026-08-07 9:45 ` Joel Granados
2026-08-07 10:05 ` Vlastimil Babka (SUSE) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2fcfa480-e4dd-477f-9c02-42756f3aa373@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shijianlin11@foxmail.com \
--cc=surenb@google.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®