lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Nov 2021 10:32:44 +0100
From:   Jan Kara <jack@...e.cz>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     akpm@...ux-foundation.org, keescook@...omium.org,
        yzaikin@...gle.com, nixiaoming@...wei.com, ebiederm@...ssion.com,
        peterz@...radead.org, gregkh@...uxfoundation.org, pjt@...gle.com,
        liu.hailong6@....com.cn, andriy.shevchenko@...ux.intel.com,
        sre@...nel.org, penguin-kernel@...ove.sakura.ne.jp,
        pmladek@...e.com, senozhatsky@...omium.org, wangqing@...o.com,
        bcrl@...ck.org, viro@...iv.linux.org.uk, jack@...e.cz,
        amir73il@...il.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 8/9] aio: move aio sysctl to aio.c

On Tue 23-11-21 12:23:46, Luis Chamberlain wrote:
> From: Xiaoming Ni <nixiaoming@...wei.com>
> 
> The kernel/sysctl.c is a kitchen sink where everyone leaves
> their dirty dishes, this makes it very difficult to maintain.
> 
> To help with this maintenance let's start by moving sysctls to
> places where they actually belong. The proc sysctl maintainers
> do not want to know what sysctl knobs you wish to add for your own
> piece of code, we just care about the core logic.
> 
> Move aio sysctl to aio.c and use the new register_sysctl_init() to
> register the sysctl interface for aio.
> 
> Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
> [mcgrof: adjust commit log to justify the move]
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>

Makes sense. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/aio.c            | 31 +++++++++++++++++++++++++++++--
>  include/linux/aio.h |  4 ----
>  kernel/sysctl.c     | 17 -----------------
>  3 files changed, 29 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 9c81cf611d65..83ef2341e73f 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -219,9 +219,35 @@ struct aio_kiocb {
>  
>  /*------ sysctl variables----*/
>  static DEFINE_SPINLOCK(aio_nr_lock);
> -unsigned long aio_nr;		/* current system wide number of aio requests */
> -unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */
> +static unsigned long aio_nr;		/* current system wide number of aio requests */
> +static unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */
>  /*----end sysctl variables---*/
> +#ifdef CONFIG_SYSCTL
> +static struct ctl_table aio_sysctls[] = {
> +	{
> +		.procname	= "aio-nr",
> +		.data		= &aio_nr,
> +		.maxlen		= sizeof(aio_nr),
> +		.mode		= 0444,
> +		.proc_handler	= proc_doulongvec_minmax,
> +	},
> +	{
> +		.procname	= "aio-max-nr",
> +		.data		= &aio_max_nr,
> +		.maxlen		= sizeof(aio_max_nr),
> +		.mode		= 0644,
> +		.proc_handler	= proc_doulongvec_minmax,
> +	},
> +	{}
> +};
> +
> +static void __init aio_sysctl_init(void)
> +{
> +	register_sysctl_init("fs", aio_sysctls);
> +}
> +#else
> +#define aio_sysctl_init() do { } while (0)
> +#endif
>  
>  static struct kmem_cache	*kiocb_cachep;
>  static struct kmem_cache	*kioctx_cachep;
> @@ -274,6 +300,7 @@ static int __init aio_setup(void)
>  
>  	kiocb_cachep = KMEM_CACHE(aio_kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
>  	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
> +	aio_sysctl_init();
>  	return 0;
>  }
>  __initcall(aio_setup);
> diff --git a/include/linux/aio.h b/include/linux/aio.h
> index b83e68dd006f..86892a4fe7c8 100644
> --- a/include/linux/aio.h
> +++ b/include/linux/aio.h
> @@ -20,8 +20,4 @@ static inline void kiocb_set_cancel_fn(struct kiocb *req,
>  				       kiocb_cancel_fn *cancel) { }
>  #endif /* CONFIG_AIO */
>  
> -/* for sysctl: */
> -extern unsigned long aio_nr;
> -extern unsigned long aio_max_nr;
> -
>  #endif /* __LINUX__AIO_H */
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 597ab5ad4879..20326d67b814 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -20,7 +20,6 @@
>   */
>  
>  #include <linux/module.h>
> -#include <linux/aio.h>
>  #include <linux/mm.h>
>  #include <linux/swap.h>
>  #include <linux/slab.h>
> @@ -3110,22 +3109,6 @@ static struct ctl_table fs_table[] = {
>  		.proc_handler	= proc_dointvec,
>  	},
>  #endif
> -#ifdef CONFIG_AIO
> -	{
> -		.procname	= "aio-nr",
> -		.data		= &aio_nr,
> -		.maxlen		= sizeof(aio_nr),
> -		.mode		= 0444,
> -		.proc_handler	= proc_doulongvec_minmax,
> -	},
> -	{
> -		.procname	= "aio-max-nr",
> -		.data		= &aio_max_nr,
> -		.maxlen		= sizeof(aio_max_nr),
> -		.mode		= 0644,
> -		.proc_handler	= proc_doulongvec_minmax,
> -	},
> -#endif /* CONFIG_AIO */
>  #ifdef CONFIG_INOTIFY_USER
>  	{
>  		.procname	= "inotify",
> -- 
> 2.33.0
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ