Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-16 Thread Waiman Long
On 02/16/2016 03:53 AM, Peter Zijlstra wrote: On Mon, Feb 15, 2016 at 06:22:14PM -0800, Jason Low wrote: On Mon, 2016-02-15 at 18:15 -0800, Jason Low wrote: On Fri, 2016-02-12 at 14:14 -0800, Davidlohr Bueso wrote: On Fri, 12 Feb 2016, Peter Zijlstra wrote: On Fri, Feb 12, 2016 at 12:32:12PM

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-16 Thread Peter Zijlstra
On Mon, Feb 15, 2016 at 06:22:14PM -0800, Jason Low wrote: > On Mon, 2016-02-15 at 18:15 -0800, Jason Low wrote: > > On Fri, 2016-02-12 at 14:14 -0800, Davidlohr Bueso wrote: > > > On Fri, 12 Feb 2016, Peter Zijlstra wrote: > > > > > > >On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote:

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Waiman Long
On 02/15/2016 10:00 PM, Jason Low wrote: On Mon, 2016-02-15 at 18:55 -0500, Waiman Long wrote: On 02/12/2016 03:40 PM, Peter Zijlstra wrote: On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock,

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Jason Low
On Mon, 2016-02-15 at 18:55 -0500, Waiman Long wrote: > On 02/12/2016 03:40 PM, Peter Zijlstra wrote: > > On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > >> @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock, > >>} > >> > >>

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Jason Low
On Mon, 2016-02-15 at 18:15 -0800, Jason Low wrote: > On Fri, 2016-02-12 at 14:14 -0800, Davidlohr Bueso wrote: > > On Fri, 12 Feb 2016, Peter Zijlstra wrote: > > > > >On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > > >> static bool mutex_optimistic_spin(struct mutex *lock, > > >>

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Jason Low
On Fri, 2016-02-12 at 14:14 -0800, Davidlohr Bueso wrote: > On Fri, 12 Feb 2016, Peter Zijlstra wrote: > > >On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > >> static bool mutex_optimistic_spin(struct mutex *lock, > >> +struct ww_acquire_ctx *ww_ctx, > >>

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Waiman Long
On 02/12/2016 03:40 PM, Peter Zijlstra wrote: On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock, } mutex_set_owner(lock); - osq_unlock(&lock-

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Waiman Long
On 02/12/2016 05:02 PM, Davidlohr Bueso wrote: On Fri, 12 Feb 2016, Waiman Long wrote: This patch adds a new waiter parameter to the mutex_optimistic_spin() function to prepare it to be used by a waiter-spinner that doesn't need to go into the OSQ as there can only be one waiter-spinner which i

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-15 Thread Waiman Long
On 02/12/2016 03:23 PM, Peter Zijlstra wrote: On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: This patch adds a new waiter parameter to the mutex_optimistic_spin() function to prepare it to be used by a waiter-spinner that doesn't need to go into the OSQ as there can only be one wai

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-13 Thread Davidlohr Bueso
On Sat, 13 Feb 2016, Peter Zijlstra wrote: Can't see it do that, also, if it were to do that, we'd not be here since having a waiter would then mean no spinners and no starvation etc.. I was having a hard time understanding why on earth you didn't see that. And yes I was also wondering why it

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-13 Thread Peter Zijlstra
On Fri, Feb 12, 2016 at 02:14:44PM -0800, Davidlohr Bueso wrote: > On Fri, 12 Feb 2016, Peter Zijlstra wrote: > > >On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > >> static bool mutex_optimistic_spin(struct mutex *lock, > >>+ struct ww_acquire_ctx *ww_ctx

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-12 Thread Davidlohr Bueso
On Fri, 12 Feb 2016, Peter Zijlstra wrote: On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: static bool mutex_optimistic_spin(struct mutex *lock, + struct ww_acquire_ctx *ww_ctx, + const bool use_ww_ctx, int waiter) {

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-12 Thread Davidlohr Bueso
On Fri, 12 Feb 2016, Davidlohr Bueso wrote: This can be a really hot path, could we get rid of the waiter check and just introduce mutex_tro_to_acquire_waiter() or such and set the counter to -1 there? Ah nm, I just realized why you do this :) For a second I thought that you called into this

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-12 Thread Davidlohr Bueso
On Fri, 12 Feb 2016, Waiman Long wrote: This patch adds a new waiter parameter to the mutex_optimistic_spin() function to prepare it to be used by a waiter-spinner that doesn't need to go into the OSQ as there can only be one waiter-spinner which is the head of the waiting queue. Signed-off-by:

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-12 Thread Peter Zijlstra
On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > @@ -358,8 +373,8 @@ static bool mutex_optimistic_spin(struct mutex *lock, > } > > mutex_set_owner(lock); > - osq_unlock(&lock->osq); > - return true;

Re: [PATCH v2 1/4] locking/mutex: Add waiter parameter to mutex_optimistic_spin()

2016-02-12 Thread Peter Zijlstra
On Fri, Feb 12, 2016 at 12:32:12PM -0500, Waiman Long wrote: > This patch adds a new waiter parameter to the mutex_optimistic_spin() > function to prepare it to be used by a waiter-spinner that doesn't > need to go into the OSQ as there can only be one waiter-spinner which > is the head of the wait