[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tn2kke5jquwjydr4hmi5h2adm4iio53yvsylmohxtebaazwcqy@i74mtkxq233x>
Date: Thu, 30 Oct 2025 14:59:25 +0100
From: Jan Kara <jack@...e.cz>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, jack@...e.cz,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] fs: touch up predicts in putname()
On Wed 29-10-25 14:49:52, Mateusz Guzik wrote:
> 1. we already expect the refcount is 1.
> 2. path creation predicts name == iname
>
> I verified this straightens out the asm, no functional changes.
>
> Signed-off-by: Mateusz Guzik <mjguzik@...il.com>
Looks sensible. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
>
> random annoyance i noticed while profiling
>
> fs/namei.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index ba29ec7b67c5..4692f25e7cd9 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -282,7 +282,7 @@ void putname(struct filename *name)
> return;
>
> refcnt = atomic_read(&name->refcnt);
> - if (refcnt != 1) {
> + if (unlikely(refcnt != 1)) {
> if (WARN_ON_ONCE(!refcnt))
> return;
>
> @@ -290,7 +290,7 @@ void putname(struct filename *name)
> return;
> }
>
> - if (name->name != name->iname) {
> + if (unlikely(name->name != name->iname)) {
> __putname(name->name);
> kfree(name);
> } else
> --
> 2.34.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists