[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240902110428.os726rhlt6y5i4ak@quack3>
Date: Mon, 2 Sep 2024 13:04:28 +0200
From: Jan Kara <jack@...e.cz>
To: Kees Cook <kees@...nel.org>
Cc: Kaixiong Yu <yukaixiong@...wei.com>, 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,
bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
viro@...iv.linux.org.uk, brauner@...nel.org, jack@...e.cz,
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,
wangkefeng.wang@...wei.com
Subject: Re: [PATCH -next 12/15] fs: dcache: move the sysctl into its own file
On Mon 26-08-24 12:56:00, Kees Cook wrote:
> On Mon, Aug 26, 2024 at 08:04:46PM +0800, Kaixiong Yu wrote:
> > The sysctl_vfs_cache_pressure belongs to fs/dcache.c, move it to
> > its own file from kernel/sysctl.c. As a part of fs/dcache.c cleaning,
> > sysctl_vfs_cache_pressure is changed to a static variable, and export
> > vfs_pressure_ratio with EXPORT_SYMBOL_GPL to be used by other files.
> > And move the unneeded include(linux/dcache.h).
> >
> > Signed-off-by: Kaixiong Yu <yukaixiong@...wei.com>
> > ---
> > fs/dcache.c | 21 +++++++++++++++++++--
> > include/linux/dcache.h | 7 +------
> > kernel/sysctl.c | 9 ---------
> > 3 files changed, 20 insertions(+), 17 deletions(-)
> >
> > diff --git a/fs/dcache.c b/fs/dcache.c
> > index 1af75fa68638..8717d5026cda 100644
> > --- a/fs/dcache.c
> > +++ b/fs/dcache.c
> > @@ -73,8 +73,13 @@
> > * If no ancestor relationship:
> > * arbitrary, since it's serialized on rename_lock
> > */
> > -int sysctl_vfs_cache_pressure __read_mostly = 100;
> > -EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
> > +static int sysctl_vfs_cache_pressure __read_mostly = 100;
> > +
> > +unsigned long vfs_pressure_ratio(unsigned long val)
> > +{
> > + return mult_frac(val, sysctl_vfs_cache_pressure, 100);
> > +}
> > +EXPORT_SYMBOL_GPL(vfs_pressure_ratio);
>
> This was a static inline, but AFAICT it's only called through
> alloc_super() which is hardly "fast path". If this series gets another
> version it may be worth calling out this inline->out-of-line change in
> the commit log.
>
> I don't think it's a blocker, but I'm not a VFS maintainer. :)
It's actually called from about 7 shrinkers of filesystem objects. They get
called relatively frequently during memory reclaim but I don't think a
function call is *that* expensive to matter in this case. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists