Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-18 Thread Waiman Long
On 08/18/2016 10:14 AM, Peter Zijlstra wrote: On Wed, Aug 10, 2016 at 11:44:08AM -0700, Jason Low wrote: diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 2cb7531..5643a233 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -57,6 +57,8 @@ struct mutex { #endif #

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-18 Thread Peter Zijlstra
On Thu, Aug 18, 2016 at 04:27:35PM +0200, Peter Zijlstra wrote: > On Wed, Aug 10, 2016 at 11:44:08AM -0700, Jason Low wrote: > > @@ -556,8 +604,12 @@ __mutex_lock_common(struct mutex *lock, long state, > > unsigned int subclass, > > * other waiters. We only attempt the xchg if the cou

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-18 Thread Peter Zijlstra
On Thu, Aug 18, 2016 at 05:18:43PM +0200, Peter Zijlstra wrote: > On Thu, Aug 18, 2016 at 04:27:35PM +0200, Peter Zijlstra wrote: > > On Wed, Aug 10, 2016 at 11:44:08AM -0700, Jason Low wrote: > > > @@ -556,8 +604,12 @@ __mutex_lock_common(struct mutex *lock, long state, > > > unsigned int subclas

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-18 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 11:44:08AM -0700, Jason Low wrote: > diff --git a/include/linux/mutex.h b/include/linux/mutex.h > index 2cb7531..5643a233 100644 > --- a/include/linux/mutex.h > +++ b/include/linux/mutex.h > @@ -57,6 +57,8 @@ struct mutex { > #endif > #ifdef CONFIG_MUTEX_SPIN_ON_OWNER >

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-18 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 11:44:08AM -0700, Jason Low wrote: > @@ -556,8 +604,12 @@ __mutex_lock_common(struct mutex *lock, long state, > unsigned int subclass, >* other waiters. We only attempt the xchg if the count is >* non-negative in order to avoid unnecessary xc

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-17 Thread Wanpeng Li
2016-08-18 2:30 GMT+08:00 Jason Low : > Hi Wanpeng, > > On Wed, 2016-08-17 at 09:41 +0800, Wanpeng Li wrote: >> 2016-08-11 2:44 GMT+08:00 Jason Low : >> > Imre reported an issue where threads are getting starved when trying >> > to acquire a mutex. Threads acquiring a mutex can get arbitrarily dela

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-17 Thread Jason Low
Hi Wanpeng, On Wed, 2016-08-17 at 09:41 +0800, Wanpeng Li wrote: > 2016-08-11 2:44 GMT+08:00 Jason Low : > > Imre reported an issue where threads are getting starved when trying > > to acquire a mutex. Threads acquiring a mutex can get arbitrarily delayed > > sleeping on a mutex because other thre

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-16 Thread Wanpeng Li
2016-08-11 2:44 GMT+08:00 Jason Low : > Imre reported an issue where threads are getting starved when trying > to acquire a mutex. Threads acquiring a mutex can get arbitrarily delayed > sleeping on a mutex because other threads can continually steal the lock > in the fastpath and/or through optimi

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-16 Thread Jason Low
On Thu, 2016-08-11 at 04:01 +0800, kbuild test robot wrote: > Hi Jason, > > [auto build test ERROR on tip/locking/core] > [also build test ERROR on v4.8-rc1 next-20160809] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > > url: > https:

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-16 Thread Jason Low
On Thu, 2016-08-11 at 11:40 -0400, Waiman Long wrote: > On 08/10/2016 02:44 PM, Jason Low wrote: > > +static inline void do_yield_to_waiter(struct mutex *lock, int *wakeups) > > +{ > > + return; > > +} > > + > > +static inline void clear_yield_to_waiter(struct mutex *lock) > > +{ > > + return;

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-11 Thread Waiman Long
On 08/10/2016 02:44 PM, Jason Low wrote: Imre reported an issue where threads are getting starved when trying to acquire a mutex. Threads acquiring a mutex can get arbitrarily delayed sleeping on a mutex because other threads can continually steal the lock in the fastpath and/or through optimisti

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-10 Thread Jason Low
On Wed, 2016-08-10 at 11:44 -0700, Jason Low wrote: > @@ -917,11 +976,12 @@ EXPORT_SYMBOL(mutex_trylock); > int __sched > __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) > { > - int ret; > + int ret = 1; > > might_sleep(); > > - ret = __mutex_fastpath_loc

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-10 Thread Jason Low
On Wed, 2016-08-10 at 11:44 -0700, Jason Low wrote: > Imre reported an issue where threads are getting starved when trying > to acquire a mutex. Threads acquiring a mutex can get arbitrarily delayed > sleeping on a mutex because other threads can continually steal the lock > in the fastpath and/or

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-10 Thread kbuild test robot
Hi Jason, [auto build test ERROR on tip/locking/core] [also build test ERROR on v4.8-rc1 next-20160809] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Jason-Low/locking-mutex-Prevent-lock-starva

Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

2016-08-10 Thread kbuild test robot
Hi Jason, [auto build test WARNING on tip/locking/core] [also build test WARNING on v4.8-rc1 next-20160809] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Jason-Low/locking-mutex-Prevent-lock-st