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]
Message-ID: <20241014121545.bdgwsw66i2yborjo@quack3>
Date: Mon, 14 Oct 2024 14:15:45 +0200
From: Jan Kara <jack@...e.cz>
To: Kaixiong Yu <yukaixiong@...wei.com>
Cc: akpm@...ux-foundation.org, mcgrof@...nel.org,
	ysato@...rs.sourceforge.jp, dalias@...c.org,
	glaubitz@...sik.fu-berlin.de, luto@...nel.org, tglx@...utronix.de,
	mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
	hpa@...or.com, viro@...iv.linux.org.uk, brauner@...nel.org,
	jack@...e.cz, kees@...nel.org, j.granados@...sung.com,
	willy@...radead.org, Liam.Howlett@...cle.com, vbabka@...e.cz,
	lorenzo.stoakes@...cle.com, trondmy@...nel.org, anna@...nel.org,
	chuck.lever@...cle.com, jlayton@...nel.org, neilb@...e.de,
	okorniev@...hat.com, Dai.Ngo@...cle.com, tom@...pey.com,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, paul@...l-moore.com, jmorris@...ei.org,
	linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
	linux-nfs@...r.kernel.org, netdev@...r.kernel.org,
	linux-security-module@...r.kernel.org, dhowells@...hat.com,
	haifeng.xu@...pee.com, baolin.wang@...ux.alibaba.com,
	shikemeng@...weicloud.com, dchinner@...hat.com, bfoster@...hat.com,
	souravpanda@...gle.com, hannes@...xchg.org, rientjes@...gle.com,
	pasha.tatashin@...een.com, david@...hat.com, ryan.roberts@....com,
	ying.huang@...el.com, yang@...amperecomputing.com,
	zev@...ilderbeest.net, serge@...lyn.com, vegard.nossum@...cle.com,
	wangkefeng.wang@...wei.com, sunnanyong@...wei.com
Subject: Re: [PATCH v3 -next 10/15] fs: drop_caches: move sysctl to
 fs/drop_caches.c

On Thu 10-10-24 23:22:10, Kaixiong Yu wrote:
> The sysctl_drop_caches to fs/drop_caches.c, move it to
> fs/drop_caches.c from /kernel/sysctl.c. And remove the
> useless extern variable declaration from include/linux/mm.h
> 
> Signed-off-by: Kaixiong Yu <yukaixiong@...wei.com>
> Reviewed-by: Kees Cook <kees@...nel.org>

Looks good. Feel free to add:

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

								Honza

> ---
> v3:
>  - change the title
> ---
>  fs/drop_caches.c   | 23 +++++++++++++++++++++--
>  include/linux/mm.h |  6 ------
>  kernel/sysctl.c    |  9 ---------
>  3 files changed, 21 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> index d45ef541d848..f2551ace800f 100644
> --- a/fs/drop_caches.c
> +++ b/fs/drop_caches.c
> @@ -14,7 +14,7 @@
>  #include "internal.h"
>  
>  /* A global variable is a bit ugly, but it keeps the code simple */
> -int sysctl_drop_caches;
> +static int sysctl_drop_caches;
>  
>  static void drop_pagecache_sb(struct super_block *sb, void *unused)
>  {
> @@ -48,7 +48,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
>  	iput(toput_inode);
>  }
>  
> -int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
> +static int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
>  		void *buffer, size_t *length, loff_t *ppos)
>  {
>  	int ret;
> @@ -77,3 +77,22 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
>  	}
>  	return 0;
>  }
> +
> +static struct ctl_table drop_caches_table[] = {
> +	{
> +		.procname	= "drop_caches",
> +		.data		= &sysctl_drop_caches,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0200,
> +		.proc_handler	= drop_caches_sysctl_handler,
> +		.extra1		= SYSCTL_ONE,
> +		.extra2		= SYSCTL_FOUR,
> +	},
> +};
> +
> +static int __init init_vm_drop_caches_sysctls(void)
> +{
> +	register_sysctl_init("vm", drop_caches_table);
> +	return 0;
> +}
> +fs_initcall(init_vm_drop_caches_sysctls);
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c7f73bf32024..ed2e7425c838 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3791,12 +3791,6 @@ static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
>  
>  extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm);
>  
> -#ifdef CONFIG_SYSCTL
> -extern int sysctl_drop_caches;
> -int drop_caches_sysctl_handler(const struct ctl_table *, int, void *, size_t *,
> -		loff_t *);
> -#endif
> -
>  void drop_slab(void);
>  
>  #ifndef CONFIG_MMU
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 373e018b950c..d638a1bac9af 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2024,15 +2024,6 @@ static struct ctl_table kern_table[] = {
>  };
>  
>  static struct ctl_table vm_table[] = {
> -	{
> -		.procname	= "drop_caches",
> -		.data		= &sysctl_drop_caches,
> -		.maxlen		= sizeof(int),
> -		.mode		= 0200,
> -		.proc_handler	= drop_caches_sysctl_handler,
> -		.extra1		= SYSCTL_ONE,
> -		.extra2		= SYSCTL_FOUR,
> -	},
>  	{
>  		.procname	= "vfs_cache_pressure",
>  		.data		= &sysctl_vfs_cache_pressure,
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ