Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-15 Thread Waiman Long
On 10/14/2015 05:28 AM, Peter Zijlstra wrote: On Tue, Oct 13, 2015 at 04:50:25PM -0400, Waiman Long wrote: On 10/13/2015 03:56 PM, Peter Zijlstra wrote: So the below is exactly duplicated from the normal slowpath, so why don't you keep that there? It would get you something like: if (

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-15 Thread Waiman Long
On 10/13/2015 04:44 PM, Peter Zijlstra wrote: On Tue, Oct 13, 2015 at 04:41:41PM -0400, Waiman Long wrote: On 10/13/2015 02:23 PM, Peter Zijlstra wrote: On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: for (;; waitcnt++) { + loop = SPIN_THRESHOLD; +

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-14 Thread Peter Zijlstra
On Tue, Oct 13, 2015 at 04:50:25PM -0400, Waiman Long wrote: > On 10/13/2015 03:56 PM, Peter Zijlstra wrote: > >So the below is exactly duplicated from the normal slowpath, so why > >don't you keep that there? > > > >It would get you something like: > > > > if (pv_wait_head_or_steal(..)) > >

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Waiman Long
On 10/13/2015 03:56 PM, Peter Zijlstra wrote: On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: +gotlock: /* +* We now have the lock. We need to either clear the tail code or +* notify the next one in queue as the new queue head. */ + old = atom

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Waiman Long
On 10/13/2015 03:39 PM, Peter Zijlstra wrote: On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: This patch allows one attempt for the lock waiter to steal the lock when entering the PV slowpath. This helps to reduce the performance penalty caused by lock waiter preemption while not h

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Peter Zijlstra
On Tue, Oct 13, 2015 at 04:41:41PM -0400, Waiman Long wrote: > On 10/13/2015 02:23 PM, Peter Zijlstra wrote: > >On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: > >>for (;; waitcnt++) { > >>+ loop = SPIN_THRESHOLD; > >>+ while (loop) { > >>+ /*

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Waiman Long
On 10/13/2015 02:23 PM, Peter Zijlstra wrote: On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: for (;; waitcnt++) { + loop = SPIN_THRESHOLD; + while (loop) { + /* +* Spin until the lock is free +

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Peter Zijlstra
On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: > +gotlock: > /* > + * We now have the lock. We need to either clear the tail code or > + * notify the next one in queue as the new queue head. >*/ > + old = atomic_read(&lock->val); > + while ((old & _Q_T

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Peter Zijlstra
On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: > This patch allows one attempt for the lock waiter to steal the lock > when entering the PV slowpath. This helps to reduce the performance > penalty caused by lock waiter preemption while not having much of > the downsides of a real unf

Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-10-13 Thread Peter Zijlstra
On Tue, Sep 22, 2015 at 04:50:43PM -0400, Waiman Long wrote: > for (;; waitcnt++) { > + loop = SPIN_THRESHOLD; > + while (loop) { > + /* > + * Spin until the lock is free > + */ > + for (