The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jianlin Shi <shijianlin11@foxmail.com>,
	linux-mm@kvack.org, vbabka@kernel.org, surenb@google.com,
	mhocko@suse.com, jackmanb@google.com, ziy@nvidia.com,
	linux-kernel@vger.kernel.org,
	Joel Granados <joel.granados@kernel.org>
Subject: Re: [PATCH v5] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write
Date: Thu, 6 Aug 2026 14:20:02 -0700	[thread overview]
Message-ID: <20260806142002.ac4a349730f3ce15154a71a5@linux-foundation.org> (raw)
In-Reply-To: <anSRGASe5FIrqwlg@cmpxchg.org>

On Thu, 6 Aug 2026 09:50:16 -0400 Johannes Weiner <hannes@cmpxchg.org> wrote:

> > -	proc_dointvec_minmax(table, write, buffer, length, ppos);
> > +	if (!write)
> > +		return proc_dointvec_minmax(table, write, buffer, length, ppos);
> >  
> > -	for (i = 0; i < MAX_NR_ZONES; i++) {
> > -		if (sysctl_lowmem_reserve_ratio[i] < 1)
> > -			sysctl_lowmem_reserve_ratio[i] = 0;
> > -	}
> 
> This could use a comment. How about:
> 
> 	/*
> 	 * proc_dointvec_max() works incrementally. Use a buffer
> 	 * and only set the values if all of them parse cleanly.
> 	 */
> 

I added a fixlet:

--- a/mm/page_alloc.c~mm-page_alloc-only-update-lowmem_reserve_ratio-on-sysctl-write-fix
+++ a/mm/page_alloc.c
@@ -6932,6 +6932,10 @@ static int lowmem_reserve_ratio_sysctl_h
 	if (!write)
 		return proc_dointvec_minmax(table, write, buffer, length, ppos);
 
+	/*
+	 * proc_dointvec_max() works incrementally. Use a buffer and only set
+	 * the values if all of them parse cleanly.
+	 */
 	memcpy(ratio, sysctl_lowmem_reserve_ratio, sizeof(ratio));
 	tmp.data = ratio;
 
_

Sashiko got all upset about concurrency issues:

	https://sashiko.dev/#/patchset/tencent_A860C873956A52E26AD8D309A308A241BA08@qq.com

But I think I'm hearing from Joel is that the longer-term plan is to fix
all this up within proc_dointvec_minmax()?

  reply	other threads:[~2026-08-06 21:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 10:32 [PATCH] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write 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 [this message]
2026-08-07  9:45       ` Joel Granados
2026-08-07 10:05   ` Vlastimil Babka (SUSE)

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=20260806142002.ac4a349730f3ce15154a71a5@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=joel.granados@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shijianlin11@foxmail.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --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