[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiYznwPjhEb-FSkRjZsgh6W6Z8+tne2EbO4qBF+hMEJtA@mail.gmail.com>
Date: Sun, 5 Oct 2025 08:48:29 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Boqun Feng <boqun.feng@...il.com>,
David Howells <dhowells@...hat.com>, Ingo Molnar <mingo@...hat.com>,
Li RongQing <lirongqing@...du.com>, Peter Zijlstra <peterz@...radead.org>,
Waiman Long <longman@...hat.com>, Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/5] seqlock: change __dentry_path() to use __SEQLOCK_READ_SECTION()
On Sun, 5 Oct 2025 at 07:52, Oleg Nesterov <oleg@...hat.com> wrote:
>
> To simplify the code and make it more readable.
Ok, so the other ones looked fine. This one I'm not convinced about.
The end result makes no sense taken alone. It does that odd
"rcu_read_unlock()" after the first loop, and it basically ends up
being very incestuous with that implementation, which means that now
you have to understand both pieces intimately to figure it out, and
they are not near each other.
It *might* be solved by just renaming 'lockless' to
'first_lockless_iteration' - not because it changes the code, but
because it makes the logic much more explicit, and then that
if (first_lockless_iteration)
rcu_read_unlock();
test inside that loop would at least make a lot more conceptual sense
without knowing the internal implementation of that macro.
But honestly, while I think that would turn it from "too ugly to live"
to "I don't love it but I can deal with it", I would wish for
something better.
Side note: that whole internal loop:
while (!IS_ROOT(dentry)) {
const struct dentry *parent = dentry->d_parent;
prefetch(parent);
if (!prepend_name(&b, &dentry->d_name))
break;
dentry = parent;
}
should be a helper function of its own, I think. And if you do that,
maybe you can switch the whole thing over to just making the first
non-locked iteration be an explicitly separate phase?
I dunno. I don't love that code in the existing format - but I think
you ended up hiding that subtlety even more.
Linus
Powered by blists - more mailing lists