[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjPvwcRwqNmvuZ=jNFyX9g8kO=ECN4u=shHiBknNuTZcA@mail.gmail.com>
Date: Sun, 5 Oct 2025 08:34:03 -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 1/5] seqlock: introduce SEQLOCK_READ_SECTION()
On Sun, 5 Oct 2025 at 07:51, Oleg Nesterov <oleg@...hat.com> wrote:
>
> +#define __SEQLOCK_READ_SECTION(lock, lockless, seq, flags) \
> + for (int lockless = 1, seq = read_seqbegin(lock); \
> + lockless || seqlock_read_section_retry(lock, &seq, flags); \
> + lockless = 0)
> ...
> +#define SEQLOCK_READ_SECTION(lock, flags) \
> + __SEQLOCK_READ_SECTION(lock, __UNIQUE_ID(lockless), __UNIQUE_ID(seq), flags)
Ok, I like the helper wrapper, but I don't actually think we need it
to be shouty.
As far as the users are concerned, the result doesn't end up being
really any different from our scoped guards, so I'd actually suggest
you just make this helper look like our scoped_guard() macro does.
And instead of making people pass in a NULL 'flags', just do a
separate version of it, exactly like we do for locking. Even if the
internal implementation then ends up sharing most of the code, please
don't make people pass in NULL just because they don't want the
irqsave version.
So make it two different things:
scoped_seqlock_read(lock) { .... }
scoped_seqlock__read_irqsave(lock, flags) { ... }
or something.
(Maybe 'flags' can even be local to that scope?)
Hmm?
Linus
Powered by blists - more mailing lists