Re: [PATCH 4/6] locking/rwsem: Avoid deceiving lock spinners

Jason Low
2015-01-29T20:13:25Z

On Wed, 2015-01-28 at 17:10 -0800, Davidlohr Bueso wrote:

> if (READ_ONCE(sem->owner))
> return true; /* new owner, continue spinning */

In terms of the sem->owner check, I agree. This also reminds me of a
similar patch I was going to send out, but for mutex. The idea is that
before we added all the MCS logic, we wanted to return false if owner
isn't NULL to prevent too many threads simultaneously spinning on the
owner at the same time.

With the new MCS queuing, we don't have to worry about that issue, so it
makes sense to continue spinning as long as owner is running and the
spinner doesn't need to reschedule.