Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-11 Thread Jason Low
On Wed, 2016-05-11 at 11:33 -0700, Davidlohr Bueso wrote: > On Wed, 11 May 2016, Peter Zijlstra wrote: > > >On Mon, May 09, 2016 at 12:16:37PM -0700, Jason Low wrote: > >> When acquiring the rwsem write lock in the slowpath, we first try > >> to set count to RWSEM_WAITING_BIAS. When that is succes

Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-11 Thread Peter Zijlstra
On Wed, May 11, 2016 at 11:26:02AM -0700, Jason Low wrote: > On Wed, 2016-05-11 at 13:49 +0200, Peter Zijlstra wrote: > > > static inline bool rwsem_try_write_lock(long count, struct rw_semaphore > > > *sem) > > > { > > > /* > > > + * Avoid trying to acquire write lock if count isn't RWSEM_W

Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-11 Thread Davidlohr Bueso
On Wed, 11 May 2016, Peter Zijlstra wrote: On Mon, May 09, 2016 at 12:16:37PM -0700, Jason Low wrote: When acquiring the rwsem write lock in the slowpath, we first try to set count to RWSEM_WAITING_BIAS. When that is successful, we then atomically add the RWSEM_WAITING_BIAS in cases where there

Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-11 Thread Jason Low
On Wed, 2016-05-11 at 13:49 +0200, Peter Zijlstra wrote: > On Mon, May 09, 2016 at 12:16:37PM -0700, Jason Low wrote: > > When acquiring the rwsem write lock in the slowpath, we first try > > to set count to RWSEM_WAITING_BIAS. When that is successful, > > we then atomically add the RWSEM_WAITING_B

Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-11 Thread Peter Zijlstra
On Mon, May 09, 2016 at 12:16:37PM -0700, Jason Low wrote: > When acquiring the rwsem write lock in the slowpath, we first try > to set count to RWSEM_WAITING_BIAS. When that is successful, > we then atomically add the RWSEM_WAITING_BIAS in cases where > there are other tasks on the wait list. This

Re: [PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-09 Thread Waiman Long
On 05/09/2016 03:16 PM, Jason Low wrote: When acquiring the rwsem write lock in the slowpath, we first try to set count to RWSEM_WAITING_BIAS. When that is successful, we then atomically add the RWSEM_WAITING_BIAS in cases where there are other tasks on the wait list. This causes write lock opera

[PATCH] locking/rwsem: Optimize write lock slowpath

2016-05-09 Thread Jason Low
When acquiring the rwsem write lock in the slowpath, we first try to set count to RWSEM_WAITING_BIAS. When that is successful, we then atomically add the RWSEM_WAITING_BIAS in cases where there are other tasks on the wait list. This causes write lock operations to often issue multiple atomic operat