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

From: Jason Low
Date: Thu Jan 29 2015 - 15:13:28 EST


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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/