Re: [PATCH-tip v2 02/12] locking/rwsem: Implement lock handoff to prevent lock starvation

From: Peter Zijlstra
Date: Wed Apr 10 2019 - 11:07:24 EST


On Fri, Apr 05, 2019 at 03:21:05PM -0400, Waiman Long wrote:
> Because of writer lock stealing, it is possible that a constant
> stream of incoming writers will cause a waiting writer or reader to
> wait indefinitely leading to lock starvation.
>
> The mutex code has a lock handoff mechanism to prevent lock starvation.
> This patch implements a similar lock handoff mechanism to disable
> lock stealing and force lock handoff to the first waiter in the queue
> after at least a 5ms waiting period. The waiting period is used to
> avoid discouraging lock stealing too much to affect performance.

So the mutex code doesn't have that timeout, it foces the handoff if the
top waiter fails to acquire.

I don't find the above sufficiently justifies the additional complexity.
What were the numbers with the simple scheme vs this etc..