Re: [PATCH v4 next 3/9] locking/osq_lock: Set prev_cpu=0 instead of locked=1

From: Peter Zijlstra

Date: Tue Sep 15 2026 - 11:22:15 EST


On Tue, Sep 15, 2026 at 02:55:13PM +0100, David Laight wrote:

> > That comment *should* obviously have been here. Also, I would *much*
> > rather have this store at the top, next to node->next = NULL; That is
> > much saner.
>
>
> Part of the original reason I started these patches was to remove
> the writes to the current cpu's 'node' in the fast path acquire.
> That completely saves reading the cache line.
> It also means the initial xchg need only have acquire semantics.

That makes no sense... you *have* to write node->prev_cpu, and since you
get to have the line dirty for that, a few more stores to the same line
are 'free', no?

Trying to make the code keep invariants like that also makes it
needlessly convoluted.

If you need a store -- and you do, then you might as well write the
whole thing.

And if you think it makes a difference, your changelogs completely lack
any factual data to that effect. That is, there are no numbers. And
without numbers, we're just not doing this.