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 - 10:32:41 EST


On Tue, Sep 15, 2026 at 03:13:15PM +0200, Peter Zijlstra wrote:
> On Mon, Sep 07, 2026 at 09:41:27AM +0100, David Laight wrote:
>
> > + /*
> > + * If 'prev' tries to remove itself from the list before we write
> > + * a new value to prev->next it will spin in osq_wait_next().
> > + */
>
> This comment pertains to what?
>
> > + /* Invalidate prev_cpu matching osq_unlock() */
> > + node->prev = 0;
>
> I'm confused, osq_unlock() does no such thing.

The next patch adds a comment stating that this store is not strictly
needed. And only serves to ensure node->prev ends up being 0 in all
paths.

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.