Re: [PATCH v2] locking/pvqspinlock: Hybrid PV queued/unfair locks

From: Eduardo Valentin
Date: Wed Nov 08 2017 - 03:40:17 EST


On Tue, Nov 07, 2017 at 04:18:06PM -0500, Waiman Long wrote:
> Currently, all the lock waiters entering the slowpath will do one
> lock stealing attempt to acquire the lock. That helps performance,
> especially in VMs with over-committed vCPUs. However, the current
> pvqspinlocks still don't perform as good as unfair locks in many cases.
> On the other hands, unfair locks do have the problem of lock starvation
> that pvqspinlocks don't have.
>
> This patch combines the best attributes of an unfair lock and a
> pvqspinlock into a hybrid lock with 2 modes - queued mode & unfair
> mode. A lock waiter goes into the unfair mode when there are waiters
> in the wait queue but the pending bit isn't set. Otherwise, it will
> go into the queued mode waiting in the queue for its turn.
>

>
> Signed-off-by: Waiman Long <longman@xxxxxxxxxx>

Reviewed-by: Eduardo Valentin <eduval@xxxxxxxxxx>

--
All the best,
Eduardo Valentin