[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250915195153.462039-12-fvdl@google.com>
Date: Mon, 15 Sep 2025 19:51:52 +0000
From: Frank van der Linden <fvdl@...gle.com>
To: akpm@...ux-foundation.org, muchun.song@...ux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: hannes@...xchg.org, david@...hat.com, roman.gushchin@...ux.dev,
Frank van der Linden <fvdl@...gle.com>
Subject: [RFC PATCH 11/12] mm/cma: rebalance CMA when changing cma_first_limit
To keep things consistent, rebalance CMA when changing the
cma_first_limit sysctl.
Signed-off-by: Frank van der Linden <fvdl@...gle.com>
---
mm/page_alloc.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dc59aaa63ae6..da1cab63995c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6640,6 +6640,24 @@ static int percpu_pagelist_high_fraction_sysctl_handler(const struct ctl_table *
return ret;
}
+#ifdef CONFIG_CMA
+static int cma_first_limit_sysctl_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *length,
+ loff_t *ppos)
+{
+ int ret, nid;
+
+ ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ if (ret || !write)
+ return ret;
+
+ for_each_node_state(nid, N_MEMORY)
+ balance_node_cma(nid, NULL);
+
+ return 0;
+}
+#endif
+
static const struct ctl_table page_alloc_sysctl_table[] = {
{
.procname = "min_free_kbytes",
@@ -6723,7 +6741,7 @@ static const struct ctl_table page_alloc_sysctl_table[] = {
.data = &cma_first_limit,
.maxlen = sizeof(cma_first_limit),
.mode = 0644,
- .proc_handler = proc_dointvec_minmax,
+ .proc_handler = cma_first_limit_sysctl_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE_HUNDRED,
},
--
2.51.0.384.g4c02a37b29-goog
Powered by blists - more mailing lists