diff mbox series

[V3,1/2] mm: compaction: move compact_memory sysctl to its own file

Message ID 202303091144483856804@zte.com.cn (mailing list archive)
State New
Headers show
Series [V3,1/2] mm: compaction: move compact_memory sysctl to its own file | expand

Commit Message

ye.xingchen@zte.com.cn March 9, 2023, 3:44 a.m. UTC
From: Minghao Chi <chi.minghao@zte.com.cn>

The compact_memory is part of compaction, move it to its own file.

Link: https://lore.kernel.org/all/ZAJwoXJCzfk1WIBx@bombadil.infradead.org/
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
---
 kernel/sysctl.c |  7 -------
 mm/compaction.c | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

Comments

Vlastimil Babka March 9, 2023, 9:47 a.m. UTC | #1
On 3/9/23 04:44, ye.xingchen@zte.com.cn wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> The compact_memory is part of compaction, move it to its own file.
> 
> Link: https://lore.kernel.org/all/ZAJwoXJCzfk1WIBx@bombadil.infradead.org/
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> ---
>  kernel/sysctl.c |  7 -------
>  mm/compaction.c | 15 +++++++++++++++
>  2 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index c14552a662ae..f574f9985df4 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2190,13 +2190,6 @@ static struct ctl_table vm_table[] = {
>  		.extra2		= SYSCTL_FOUR,
>  	},
>  #ifdef CONFIG_COMPACTION
> -	{
> -		.procname	= "compact_memory",
> -		.data		= NULL,
> -		.maxlen		= sizeof(int),
> -		.mode		= 0200,
> -		.proc_handler	= sysctl_compaction_handler,
> -	},
>  	{
>  		.procname	= "compaction_proactiveness",
>  		.data		= &sysctl_compaction_proactiveness,

There's also this one, and two more, please move all of them at once?

> diff --git a/mm/compaction.c b/mm/compaction.c
> index 5a9501e0ae01..acbda28c11f4 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -2763,6 +2763,18 @@ int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int write,
>  	return 0;
>  }
> 
> +#ifdef CONFIG_SYSCTL
> +static struct ctl_table vm_compact_memory[] = {
> +	{
> +		.procname	= "compact_memory",
> +		.data		= NULL,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0200,
> +		.proc_handler	= sysctl_compaction_handler,
> +	},
> +	{ }
> +};
> +#endif
>  /*
>   * This is the entry point for compacting all nodes via
>   * /proc/sys/vm/compact_memory
> @@ -3078,6 +3090,9 @@ static int __init kcompactd_init(void)
> 
>  	for_each_node_state(nid, N_MEMORY)
>  		kcompactd_run(nid);
> +#ifdef CONFIG_SYSCTL
> +	register_sysctl_init("vm", vm_compact_memory);
> +#endif
>  	return 0;
>  }
>  subsys_initcall(kcompactd_init)
Luis Chamberlain March 19, 2023, 8:54 p.m. UTC | #2
On Thu, Mar 09, 2023 at 10:47:46AM +0100, Vlastimil Babka wrote:
> On 3/9/23 04:44, ye.xingchen@zte.com.cn wrote:
> > From: Minghao Chi <chi.minghao@zte.com.cn>
> > 
> > The compact_memory is part of compaction, move it to its own file.
> > 
> > Link: https://lore.kernel.org/all/ZAJwoXJCzfk1WIBx@bombadil.infradead.org/
> > Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> > Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> > ---
> >  kernel/sysctl.c |  7 -------
> >  mm/compaction.c | 15 +++++++++++++++
> >  2 files changed, 15 insertions(+), 7 deletions(-)
> > 
> > diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> > index c14552a662ae..f574f9985df4 100644
> > --- a/kernel/sysctl.c
> > +++ b/kernel/sysctl.c
> > @@ -2190,13 +2190,6 @@ static struct ctl_table vm_table[] = {
> >  		.extra2		= SYSCTL_FOUR,
> >  	},
> >  #ifdef CONFIG_COMPACTION
> > -	{
> > -		.procname	= "compact_memory",
> > -		.data		= NULL,
> > -		.maxlen		= sizeof(int),
> > -		.mode		= 0200,
> > -		.proc_handler	= sysctl_compaction_handler,
> > -	},
> >  	{
> >  		.procname	= "compaction_proactiveness",
> >  		.data		= &sysctl_compaction_proactiveness,
> 
> There's also this one, and two more, please move all of them at once?

I'll wait for a v4, and if you can rebase on top of this tree that would
be appreciated:

https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=sysctl-next

  Luis
diff mbox series

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c14552a662ae..f574f9985df4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2190,13 +2190,6 @@  static struct ctl_table vm_table[] = {
 		.extra2		= SYSCTL_FOUR,
 	},
 #ifdef CONFIG_COMPACTION
-	{
-		.procname	= "compact_memory",
-		.data		= NULL,
-		.maxlen		= sizeof(int),
-		.mode		= 0200,
-		.proc_handler	= sysctl_compaction_handler,
-	},
 	{
 		.procname	= "compaction_proactiveness",
 		.data		= &sysctl_compaction_proactiveness,
diff --git a/mm/compaction.c b/mm/compaction.c
index 5a9501e0ae01..acbda28c11f4 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2763,6 +2763,18 @@  int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int write,
 	return 0;
 }

+#ifdef CONFIG_SYSCTL
+static struct ctl_table vm_compact_memory[] = {
+	{
+		.procname	= "compact_memory",
+		.data		= NULL,
+		.maxlen		= sizeof(int),
+		.mode		= 0200,
+		.proc_handler	= sysctl_compaction_handler,
+	},
+	{ }
+};
+#endif
 /*
  * This is the entry point for compacting all nodes via
  * /proc/sys/vm/compact_memory
@@ -3078,6 +3090,9 @@  static int __init kcompactd_init(void)

 	for_each_node_state(nid, N_MEMORY)
 		kcompactd_run(nid);
+#ifdef CONFIG_SYSCTL
+	register_sysctl_init("vm", vm_compact_memory);
+#endif
 	return 0;
 }
 subsys_initcall(kcompactd_init)