Re: [PATCH v4 08/16] locking/rwsem: Make rwsem_spin_on_owner() return owner state

From: Peter Zijlstra
Date: Thu Apr 18 2019 - 04:39:49 EST


On Wed, Apr 17, 2019 at 02:29:02PM -0400, Waiman Long wrote:
> On 04/17/2019 08:47 AM, Peter Zijlstra wrote:
> >>
> >> enum owner_state {
> >> OWNER_NULL = 1 << 0,
> >> OWNER_WRITER = 1 << 1,
> >> OWNER_READER = 1 << 2,
> >> OWNER_NONSPINNABLE = 1 << 3,
> >> };
> >> #define OWNER_SPINNABLE (OWNER_NULL | OWNER_WRITER)
> > Hmm, we should not spin on OWNER_NULL. Or at least not mixed in with the
> > patch that changes the shape of all this. That should go in the RT
> > thingy patch, which comes after this.
>
> We do spin on OWNER_NULL right now, not in rwsem_spin_on_owner() but in
> the main rwsem_optimistic_spin() function.
>
> RT task will quit if owner is NULL.

Yeah, I figured it out eventually :-)