[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh3h5cV=UiTg+gvqB-T6+pStDNH0+6w4i34qMC1BQwmpg@mail.gmail.com>
Date: Thu, 9 Oct 2025 13:24:51 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Oleg Nesterov <oleg@...hat.com>, 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>,
Waiman Long <longman@...hat.com>, Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/4] seqlock: introduce scoped_seqlock_read() and scoped_seqlock_read_irqsave()
On Thu, 9 Oct 2025 at 13:12, Peter Zijlstra <peterz@...radead.org> wrote:
>
> Slightly nicer version that's actually compiled :-)
I assume that "target of ss_lockless" is an intentional extension to
just make the loop never take a lock at all?
I do like it, but I think you'll find that having a separate 'seq' and
'flags' like this:
> +struct ss_tmp {
> + enum ss_state state;
> + int seq;
> + unsigned long flags;
> + spinlock_t *lock;
> +};
makes it unnecessarily waste a register.
You never need both seq and flags at the same time, since if you take
the spinlock the sequence number is pointless.
So please make that a union, and I think it will help avoid wasting a
register in the loop.
Other than that I like it. Except that "BUG()" really bugs me. It will
generate horrendous code for no reason and we *really* shouldn't add
BUG statements anyway.
Either that inline function is fine, or it isn't. Don't make it
generate stupid code for "I'm not fine" that will also be a huge pain
to debug because if that code is buggy it will presumably trigger in
context where the machine will be dead, dead, dead.
Linus
Powered by blists - more mailing lists