* [PATCH] mm/page_alloc: drop staging copy in lowmem_reserve_ratio_sysctl_handler
@ 2026-11-26 12:08 Joel Granados
0 siblings, 0 replies; only message in thread
From: Joel Granados @ 2026-11-26 12:08 UTC (permalink / raw)
To: Andrew Morton, Vlastimil Babka, Suren Baghdasaryan, Michal Hocko,
Brendan Jackman, Johannes Weiner, Zi Yan
Cc: linux-mm, linux-kernel, Joel Granados
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>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 12:08 [PATCH] mm/page_alloc: drop staging copy in lowmem_reserve_ratio_sysctl_handler Joel Granados
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®