mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Granados <joel.granados@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	 Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <brendan.jackman@linux.dev>,
	 Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Joel Granados <joel.granados@kernel.org>
Subject: [PATCH] mm/page_alloc: drop staging copy in lowmem_reserve_ratio_sysctl_handler
Date: Thu, 26 Nov 2026 13:08:10 +0100	[thread overview]
Message-ID: <20261126-lklm-sysctl-remvectmp-v1-1-602568b53c0b@kernel.org> (raw)

sysctl_lowmem_reserve_ratio[] can no longer be left partially updated as
sysctl now stages vector writes and commits after making sure that there
are no parse errors. Remove the local copy and let the staging happen
within sysctl.

Link: https://lore.kernel.org/20260814-lklm-partial_ctlvec-v2-0-9df50d26e477@kernel.org
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
Now that sysctl vectors cannot be left partially updated due to
formating errors, there is no longer a need to stage it in the caller.
---
 mm/page_alloc.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2fef4092c913c1c06d827a37e8af60641129b44e..54b93f5367df5b4fd00fec225611447a87917beb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6927,26 +6927,14 @@ static int sysctl_min_slab_ratio_sysctl_handler(const struct ctl_table *table, i
 static int lowmem_reserve_ratio_sysctl_handler(const struct ctl_table *table,
 		int write, void *buffer, size_t *length, loff_t *ppos)
 {
-	struct ctl_table tmp = *table;
-	int ratio[ARRAY_SIZE(sysctl_lowmem_reserve_ratio)];
 	int rc;
 
-	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;
-
-	rc = proc_dointvec_minmax(&tmp, write, buffer, length, ppos);
+	rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
 	if (rc)
 		return rc;
 
-	memcpy(sysctl_lowmem_reserve_ratio, ratio, sizeof(ratio));
-	setup_per_zone_lowmem_reserve();
+	if (write)
+		setup_per_zone_lowmem_reserve();
 
 	return 0;
 }

---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20260922-lklm-sysctl-remvectmp-514b807157fa

Best regards,
-- 
Joel Granados <joel.granados@kernel.org>



                 reply	other threads:[~2026-11-26 12:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261126-lklm-sysctl-remvectmp-v1-1-602568b53c0b@kernel.org \
    --to=joel.granados@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.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

all inboxes | Powered by JetHome®