Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-30 Thread Waiman Long
On 08/30/2016 07:53 AM, Peter Zijlstra wrote: On Mon, Aug 29, 2016 at 05:41:09PM +0200, Peter Zijlstra wrote: On Fri, Aug 26, 2016 at 07:40:34PM -0400, Waiman Long wrote: On 08/26/2016 11:18 AM, Peter Zijlstra wrote: Still need to look at adding spinning to the handoff case. Also need to look

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-30 Thread Peter Zijlstra
On Mon, Aug 29, 2016 at 05:41:09PM +0200, Peter Zijlstra wrote: > On Fri, Aug 26, 2016 at 07:40:34PM -0400, Waiman Long wrote: > > On 08/26/2016 11:18 AM, Peter Zijlstra wrote: > > > >Still need to look at adding spinning to the handoff case. > > >Also need to look at writing (much) better changel

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-29 Thread Peter Zijlstra
On Fri, Aug 26, 2016 at 07:40:34PM -0400, Waiman Long wrote: > On 08/26/2016 11:18 AM, Peter Zijlstra wrote: > >Still need to look at adding spinning to the handoff case. > >Also need to look at writing (much) better changelogs, they stink. > > > > I have looked at the handoff code and I didn't s

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-26 Thread Waiman Long
On 08/26/2016 11:18 AM, Peter Zijlstra wrote: On Fri, Aug 26, 2016 at 10:30:31AM -0400, Waiman Long wrote: On 08/25/2016 06:23 PM, Peter Zijlstra wrote: You're right.. I'll try again tomorrow. Actually, it is also OK to handoff from NULL=>new, but nothing else is appropriate. I pushed out new

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-26 Thread Peter Zijlstra
On Fri, Aug 26, 2016 at 10:30:31AM -0400, Waiman Long wrote: > On 08/25/2016 06:23 PM, Peter Zijlstra wrote: > >You're right.. I'll try again tomorrow. > > Actually, it is also OK to handoff from NULL=>new, but nothing else is > appropriate. I pushed out new patches to git, could you have a peek

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-26 Thread Waiman Long
On 08/25/2016 06:23 PM, Peter Zijlstra wrote: On Thu, Aug 25, 2016 at 06:00:19PM -0400, Waiman Long wrote: On 08/25/2016 02:37 PM, Peter Zijlstra wrote: @@ -468,9 +496,12 @@ void __sched mutex_unlock(struct mutex * DEBUG_LOCKS_WARN_ON(__mutex_owner(lock) != current); #endif - o

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-25 Thread Peter Zijlstra
On Thu, Aug 25, 2016 at 06:00:19PM -0400, Waiman Long wrote: > On 08/25/2016 02:37 PM, Peter Zijlstra wrote: > >@@ -468,9 +496,12 @@ void __sched mutex_unlock(struct mutex * > > DEBUG_LOCKS_WARN_ON(__mutex_owner(lock) != current); > > #endif > > > >-owner = atomic_long_fetch_and(MUTEX_FLAG

Re: [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation

2016-08-25 Thread Waiman Long
On 08/25/2016 02:37 PM, Peter Zijlstra wrote: @@ -468,9 +496,12 @@ void __sched mutex_unlock(struct mutex * DEBUG_LOCKS_WARN_ON(__mutex_owner(lock) != current); #endif - owner = atomic_long_fetch_and(MUTEX_FLAGS,&lock->owner); + owner = atomic_long_read(&lock->owner); +