Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-17 Thread Waiman Long
On 09/16/2015 11:01 AM, Peter Zijlstra wrote: On Tue, Sep 15, 2015 at 11:29:14AM -0400, Waiman Long wrote: Only the queue head vCPU will be in pv_wait_head() spinning to acquire the lock. But what will guarantee fwd progress for the lock that is the head? Suppose CPU0 becomes head and enters

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-17 Thread Waiman Long
On 09/16/2015 11:01 AM, Peter Zijlstra wrote: On Tue, Sep 15, 2015 at 11:29:14AM -0400, Waiman Long wrote: Only the queue head vCPU will be in pv_wait_head() spinning to acquire the lock. But what will guarantee fwd progress for the lock that is the head? Suppose CPU0 becomes head and enters

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-16 Thread Peter Zijlstra
On Tue, Sep 15, 2015 at 11:29:14AM -0400, Waiman Long wrote: > Only the queue head vCPU will be in pv_wait_head() spinning to acquire the > lock. But what will guarantee fwd progress for the lock that is the head? Suppose CPU0 becomes head and enters the /* claim the lock */ loop. Then CPU1

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-16 Thread Peter Zijlstra
On Tue, Sep 15, 2015 at 11:29:14AM -0400, Waiman Long wrote: > Only the queue head vCPU will be in pv_wait_head() spinning to acquire the > lock. But what will guarantee fwd progress for the lock that is the head? Suppose CPU0 becomes head and enters the /* claim the lock */ loop. Then CPU1

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-15 Thread Waiman Long
On 09/15/2015 04:24 AM, Peter Zijlstra wrote: On Mon, Sep 14, 2015 at 03:15:20PM -0400, Waiman Long wrote: On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: This patch allows one attempt for the lock waiter to steal the lock

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-15 Thread Peter Zijlstra
On Mon, Sep 14, 2015 at 03:15:20PM -0400, Waiman Long wrote: > On 09/14/2015 10:00 AM, Peter Zijlstra wrote: > >On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: > >>This patch allows one attempt for the lock waiter to steal the lock ^^^ > >>when entering the PV

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-15 Thread Peter Zijlstra
On Mon, Sep 14, 2015 at 03:15:20PM -0400, Waiman Long wrote: > On 09/14/2015 10:00 AM, Peter Zijlstra wrote: > >On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: > >>This patch allows one attempt for the lock waiter to steal the lock ^^^ > >>when entering the PV

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-15 Thread Waiman Long
On 09/15/2015 04:24 AM, Peter Zijlstra wrote: On Mon, Sep 14, 2015 at 03:15:20PM -0400, Waiman Long wrote: On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: This patch allows one attempt for the lock waiter to steal the lock

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 03:15 PM, Waiman Long wrote: On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 10:04 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 09:57 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: +#define queued_spin_trylock(l) pv_queued_spin_trylock_unfair(l) +static inline bool pv_queued_spin_trylock_unfair(struct qspinlock *lock) +{ + struct __qspinlock *l = (void *)lock;

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: > +#define queued_spin_trylock(l) pv_queued_spin_trylock_unfair(l) > +static inline bool pv_queued_spin_trylock_unfair(struct qspinlock *lock) > +{ > + struct __qspinlock *l = (void *)lock; > + > + if (READ_ONCE(l->locked))

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: > +#define queued_spin_trylock(l) pv_queued_spin_trylock_unfair(l) > +static inline bool pv_queued_spin_trylock_unfair(struct qspinlock *lock) > +{ > + struct __qspinlock *l = (void *)lock; > + > + if (READ_ONCE(l->locked))

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Peter Zijlstra
On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 09:57 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -0400, Waiman Long wrote: +#define queued_spin_trylock(l) pv_queued_spin_trylock_unfair(l) +static inline bool pv_queued_spin_trylock_unfair(struct qspinlock *lock) +{ + struct __qspinlock *l = (void *)lock;

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 10:04 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

Re: [PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-14 Thread Waiman Long
On 09/14/2015 03:15 PM, Waiman Long wrote: On 09/14/2015 10:00 AM, Peter Zijlstra wrote: On Fri, Sep 11, 2015 at 02:37:37PM -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

[PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-11 Thread Waiman Long
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 unfair lock. Linux kernel builds were run in KVM guest on an 8-socket,

[PATCH v6 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt

2015-09-11 Thread Waiman Long
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 unfair lock. Linux kernel builds were run in KVM guest on an 8-socket,