Re: [RFC][PATCH 2/3] locking/qspinlock: Rework some comments
From: Peter Zijlstra
Date: Tue Oct 02 2018 - 09:44:07 EST
On Tue, Oct 02, 2018 at 02:20:05PM +0100, Will Deacon wrote:
> > Ah, so the reason I write it like so is because when we get here,
> > val.locked_pending == 0, per the atomic_cond_read_acquire() condition.
>
> Ah, and I vaguely remember discussing this before. The way I read these
> transition diagrams, I find it most useful if they correspond to the lock
> word in memory. That way, it makes it clear about exactly which fields are
> stable, and which can be concurrently modified. So in the comment above,
> saying:
>
> *,*,0 -> *,*,1 : lock, contended
>
> is really helpful, because it clearly says "we're taking the lock, but the
> rest of the lock word could be modified by others at the same time", whereas
> saying:
>
> *,0,0 -> *,0,1 : lock, contended
>
> implies to me that pending is stable and cannot be set concurrently.
Fair enough, will restore.