Re: [PATCH v2 1/4] seqlock: introduce scoped_seqlock_read() and scoped_seqlock_read_irqsave()
From: Oleg Nesterov
Date: Fri Oct 10 2025 - 08:33:45 EST
On 10/10, Peter Zijlstra wrote:
>
> I reordered the code, it is happier now.
>
> Anyway, the below seems to generate decent code for
> {-O2,-Os}x{gcc-14,clang-22}. Yay for optimizing compilers I suppose :-)
Another approach which looks better than mine ;)
Linus's version is simpler, but yours can handle break/return and
the "only lockless" case, good.
I leave this patch to you and Linus, he seems to like your code too.
Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>
But... perhaps we should not "export" the _target names and instead
add the additional defines, something like
scoped_seqlock_read()
scoped_seqlock_read_or_lock()
scoped_seqlock_read_or_lock_irqsave()
?
Oleg.