[PATCH] mm/page_alloc: drop staging copy in lowmem_reserve_ratio_sysctl_handler
From: Joel Granados
Date: Thu Nov 26 2026 - 07:08:40 EST
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@xxxxxxxxxx
Signed-off-by: Joel Granados <joel.granados@xxxxxxxxxx>
---
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@xxxxxxxxxx>