[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGudoHFWJWdE26kEGdj=83KJ_gJi9BwRiOUQ1Gy=1i9u4fgJSA@mail.gmail.com>
Date: Tue, 26 Sep 2023 17:40:33 +0200
From: Mateusz Guzik <mjguzik@...il.com>
To: Christian Brauner <brauner@...nel.org>
Cc: viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, torvalds@...ux-foundation.org
Subject: Re: [PATCH] vfs: shave work on failed file open
On 9/26/23, Christian Brauner <brauner@...nel.org> wrote:
>> > if (WARN_ON_ONCE(atomic_long_cmpxchg(&file->f_count, 1, 0) != 1)) {
>
>> bench again.
>
> Can you see how much of a difference it makes because imho it really
> looks a lot nicer then this ugly atomic_read followed by atomic_set...
>
Huh, turns out to be in the noise here and I see why.
Immediately following this there are several atomic ops anyway,
notably to unref creds and apparmor labels. So happens top of the
profile is the allocator(!).
These can be fixed but that's perhaps for another time.
If going this route then perhaps atomic_long_dec_and_test just like
fput? Although one could argue if that cmpxchg failed then something
fishy is going on and "real" fput would be safer. Ultimately there is
a lot of handwaving possible whichever way, so just pick something and
I'll send a v2.
--
Mateusz Guzik <mjguzik gmail.com>
Powered by blists - more mailing lists