sysctl: Limit the value of interface compact_memory
Subsystems (4)
PATCH v2 1/2 sysctl: Limit the value of interface compact_memory
From: Minghao Chi <[email protected]>
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.
--- include/linux/compaction.h | 1 + kernel/sysctl.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/linux/compaction.h +1 -0
@@ -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);
kernel/sysctl.c +3 -1
@@ -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",
Signature · 1 line
2.25.1
Quoted 8 lines · On 3/6/23 07:07, [email protected] wrote:
From: Minghao Chi <[email protected]>
In
Documentation/admin-guide/sysctl/vm.rst:109say: 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 interfacecompact_memoryto 1.
I don't think the split to two patches you did, achieves Luis' request.
Quoted 25 lines
Signed-off-by Minghao Chi <[email protected]>Signed-off-by Ye Xingchen <[email protected]>--- include/linux/compaction.h | 1 + kernel/sysctl.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)include/linux/compaction.h +1
-0@@ -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);kernel/sysctl.c +0
-0
kernel/sysctl.c static struct ctl_table vm_table[] = { · line 2195
Quoted 5 lines
kernel/sysctl.c +1
-1@@ -2192,10 +2192,12 @@ static struct ctl_table vm_table[] = {#ifdef CONFIG_COMPACTION { .procname = "compact_memory", - .data = NULL, + .data = &sysctl_compact_memory,
I doubt this compiles/links without patch 2, as there's no definition until patch 2.
kernel/sysctl.c static struct ctl_table vm_table[] = { · line 2203
Quoted 8 lines
kernel/sysctl.c +2
-0.maxlen = sizeof(int), .mode = 0200, .proc_handler = sysctl_compaction_handler, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_ONE, }, { .procname = "compaction_proactiveness",
IIUC his request was to move the compaction entries out of sysctl.c?
Quoted 10 lines · Vlastimil Babka
Quoted 7 lines · On 3/6/23 07:07, [email protected] wrote:
From: Minghao Chi <[email protected]>
In
Documentation/admin-guide/sysctl/vm.rst:109say: 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 interfacecompact_memoryto 1.
Quoted 5 lines
Quoted 1 line
I don't think the split to two patches you did, achieves Luis' request.
IIUC his request was to move the compaction entries out of
sysctl.c?
Yes, thanks Vlastimil, just git log kernel/sysctl.c and you'll see tons of examples.
Luis