Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-23 Thread Waiman Long
On 04/18/2015 11:40 AM, Peter Zijlstra wrote: On Fri, Apr 17, 2015 at 10:03:18PM -0400, Waiman Long wrote: @@ -478,7 +515,28 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) { unsigned long flags; - raw_spin_lock_irqsave(>wait_lock, flags); + /* +* If

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-23 Thread Waiman Long
On 04/18/2015 11:40 AM, Peter Zijlstra wrote: On Fri, Apr 17, 2015 at 10:03:18PM -0400, Waiman Long wrote: @@ -478,7 +515,28 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) { unsigned long flags; - raw_spin_lock_irqsave(sem-wait_lock, flags); + /* +*

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-22 Thread Waiman Long
On 04/20/2015 04:23 PM, Jason Low wrote: On Fri, 2015-04-17 at 22:03 -0400, Waiman Long wrote: diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h index 3a6490e..703ea5c 100644 --- a/include/linux/osq_lock.h +++ b/include/linux/osq_lock.h @@ -32,4 +32,9 @@ static inline void

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-22 Thread Waiman Long
On 04/20/2015 04:23 PM, Jason Low wrote: On Fri, 2015-04-17 at 22:03 -0400, Waiman Long wrote: diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h index 3a6490e..703ea5c 100644 --- a/include/linux/osq_lock.h +++ b/include/linux/osq_lock.h @@ -32,4 +32,9 @@ static inline void

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-20 Thread Jason Low
On Fri, 2015-04-17 at 22:03 -0400, Waiman Long wrote: > diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h > index 3a6490e..703ea5c 100644 > --- a/include/linux/osq_lock.h > +++ b/include/linux/osq_lock.h > @@ -32,4 +32,9 @@ static inline void osq_lock_init(struct >

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-20 Thread Jason Low
On Fri, 2015-04-17 at 22:03 -0400, Waiman Long wrote: diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h index 3a6490e..703ea5c 100644 --- a/include/linux/osq_lock.h +++ b/include/linux/osq_lock.h @@ -32,4 +32,9 @@ static inline void osq_lock_init(struct optimistic_spin_queue

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-18 Thread Peter Zijlstra
On Fri, Apr 17, 2015 at 10:03:18PM -0400, Waiman Long wrote: > @@ -478,7 +515,28 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) > { > unsigned long flags; > > - raw_spin_lock_irqsave(>wait_lock, flags); > + /* > + * If a spinner is present, it is not necessary

Re: [PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-18 Thread Peter Zijlstra
On Fri, Apr 17, 2015 at 10:03:18PM -0400, Waiman Long wrote: @@ -478,7 +515,28 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) { unsigned long flags; - raw_spin_lock_irqsave(sem-wait_lock, flags); + /* + * If a spinner is present, it is not necessary to do

[PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-17 Thread Waiman Long
In up_read()/up_write(), rwsem_wake() will be called whenever it detects that some writers/readers are waiting. The rwsem_wake() function will take the wait_lock and call __rwsem_do_wake() to do the real wakeup. This can be a problem especially for up_read() where many readers can potentially

[PATCH] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write

2015-04-17 Thread Waiman Long
In up_read()/up_write(), rwsem_wake() will be called whenever it detects that some writers/readers are waiting. The rwsem_wake() function will take the wait_lock and call __rwsem_do_wake() to do the real wakeup. This can be a problem especially for up_read() where many readers can potentially