[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202303061407332798543@zte.com.cn>
Date: Mon, 6 Mar 2023 14:07:33 +0800 (CST)
From: <ye.xingchen@....com.cn>
To: <mcgrof@...nel.org>
Cc: <keescook@...omium.org>, <yzaikin@...gle.com>,
<akpm@...ux-foundation.org>, <linmiaohe@...wei.com>,
<chi.minghao@....com.cn>, <linux-kernel@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: [PATCH V2 1/2] sysctl: Limit the value of interface compact_memory
From: Minghao Chi <chi.minghao@....com.cn>
In Documentation/admin-guide/sysctl/vm.rst:109 say: when 1 is written
to the file, all zones are compacted such that free memory is available
in contiguous blocks where possible.
So limit the value of interface compact_memory to 1.
Link: https://lore.kernel.org/all/ZAJwoXJCzfk1WIBx@bombadil.infradead.org/
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
Signed-off-by: Ye Xingchen <ye.xingchen@....com.cn>
---
include/linux/compaction.h | 1 +
kernel/sysctl.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 52a9ff65faee..caa24e33eeb1 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -81,6 +81,7 @@ static inline unsigned long compact_gap(unsigned int order)
}
#ifdef CONFIG_COMPACTION
+extern int sysctl_compact_memory;
extern unsigned int sysctl_compaction_proactiveness;
extern int sysctl_compaction_handler(struct ctl_table *table, int write,
void *buffer, size_t *length, loff_t *ppos);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c14552a662ae..67f70952f71a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2192,10 +2192,12 @@ static struct ctl_table vm_table[] = {
#ifdef CONFIG_COMPACTION
{
.procname = "compact_memory",
- .data = NULL,
+ .data = &sysctl_compact_memory,
.maxlen = sizeof(int),
.mode = 0200,
.proc_handler = sysctl_compaction_handler,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_ONE,
},
{
.procname = "compaction_proactiveness",
--
2.25.1
Powered by blists - more mailing lists