Re: [PATCH v2] locking: SIX locks (shared/intent/exclusive)

From: Kent Overstreet
Date: Tue May 23 2023 - 00:20:03 EST


On Mon, May 22, 2023 at 03:05:25PM -0700, Boqun Feng wrote:
> > + * bits 29-30 has read waiters
> > + * bits 30-31 has intent waiters
> > + * bits 31-32 has write waiters
> > + */
> > +
> > +#define SIX_LOCK_HELD_read_OFFSET 0
> > +#define SIX_LOCK_HELD_read ~(~0U << 26)
> > +#define SIX_LOCK_HELD_intent (1U << 26)
> > +#define SIX_LOCK_HELD_write (1U << 27)
> > +#define SIX_LOCK_WAITING_read (1U << (28 + SIX_LOCK_read))
> > +#define SIX_LOCK_WAITING_intent (1U << (28 + SIX_LOCK_intent))
> > +#define SIX_LOCK_WAITING_write (1U << (28 + SIX_LOCK_write))
> > +#define SIX_LOCK_NOSPIN (1U << 31)
>
> ^ NOSPIN is the 31st bit.

Thanks - I think I'll just delete that comment, it's out of date and
the state bits have simplified a bit :)