Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-19 Thread Waiman Long
On 05/14/2014 03:13 PM, Radim Krčmář wrote: 2014-05-14 19:00+0200, Peter Zijlstra: On Wed, May 14, 2014 at 06:51:24PM +0200, Radim Krčmář wrote: Ok. I've seen merit in pvqspinlock even with slightly slower first-waiter, so I would have happily sacrificed those horrible branches. (I prefer elega

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-14 Thread Radim Krčmář
2014-05-14 19:00+0200, Peter Zijlstra: > On Wed, May 14, 2014 at 06:51:24PM +0200, Radim Krčmář wrote: > > Ok. > > I've seen merit in pvqspinlock even with slightly slower first-waiter, > > so I would have happily sacrificed those horrible branches. > > (I prefer elegant to optimized code, but I ca

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-14 Thread Peter Zijlstra
On Wed, May 14, 2014 at 06:51:24PM +0200, Radim Krčmář wrote: > Ok. > I've seen merit in pvqspinlock even with slightly slower first-waiter, > so I would have happily sacrificed those horrible branches. > (I prefer elegant to optimized code, but I can see why we want to be > strictly better than t

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-14 Thread Radim Krčmář
2014-05-13 15:47-0400, Waiman Long: > On 05/12/2014 11:22 AM, Radim Krčmář wrote: > >I think there is an unwanted scenario on virtual machines: > >1) VCPU sets the pending bit and start spinning. > >2) Pending VCPU gets descheduled. > > - we have PLE and lock holder isn't running [1] > > -

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-13 Thread Waiman Long
On 05/12/2014 11:22 AM, Radim Krčmář wrote: 2014-05-07 11:01-0400, Waiman Long: From: Peter Zijlstra Because the qspinlock needs to touch a second cacheline; add a pending bit and allow a single in-word spinner before we punt to the second cacheline. I think there is an unwanted scenario on vi

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-12 Thread Peter Zijlstra
On Mon, May 12, 2014 at 05:22:08PM +0200, Radim Krčmář wrote: > 2014-05-07 11:01-0400, Waiman Long: > > From: Peter Zijlstra > > > > Because the qspinlock needs to touch a second cacheline; add a pending > > bit and allow a single in-word spinner before we punt to the second > > cacheline. > > I

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-12 Thread Radim Krčmář
2014-05-07 11:01-0400, Waiman Long: > From: Peter Zijlstra > > Because the qspinlock needs to touch a second cacheline; add a pending > bit and allow a single in-word spinner before we punt to the second > cacheline. I think there is an unwanted scenario on virtual machines: 1) VCPU sets the pen

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-09 Thread Waiman Long
On 05/08/2014 02:57 PM, Peter Zijlstra wrote: On Wed, May 07, 2014 at 11:01:31AM -0400, Waiman Long wrote: +/** + * trylock_pending - try to acquire queue spinlock using the pending bit + * @lock : Pointer to queue spinlock structure + * @pval : Pointer to value of the queue spinlock 32-bit word

Re: [PATCH v10 03/19] qspinlock: Add pending bit

2014-05-08 Thread Peter Zijlstra
On Wed, May 07, 2014 at 11:01:31AM -0400, Waiman Long wrote: > +/** > + * trylock_pending - try to acquire queue spinlock using the pending bit > + * @lock : Pointer to queue spinlock structure > + * @pval : Pointer to value of the queue spinlock 32-bit word > + * Return: 1 if lock acquired, 0 othe

[PATCH v10 03/19] qspinlock: Add pending bit

2014-05-07 Thread Waiman Long
From: Peter Zijlstra Because the qspinlock needs to touch a second cacheline; add a pending bit and allow a single in-word spinner before we punt to the second cacheline. Signed-off-by: Peter Zijlstra Signed-off-by: Waiman Long --- include/asm-generic/qspinlock_types.h | 12 +++- kernel/loc