Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-23 Thread Waiman Long
On 07/22/2013 06:34 AM, Ingo Molnar wrote: * Waiman Long wrote: I had run some performance tests using the fserver and new_fserver benchmarks (on ext4 filesystems) of the AIM7 test suite on a 80-core DL980 with HT on. The following kernels were used: 1. Modified 3.10.1 kernel with

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-23 Thread Waiman Long
On 07/21/2013 01:42 AM, Raghavendra K T wrote: On 07/18/2013 07:49 PM, Waiman Long wrote: On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: [...] + * an

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-23 Thread Waiman Long
On 07/21/2013 01:42 AM, Raghavendra K T wrote: On 07/18/2013 07:49 PM, Waiman Long wrote: On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: [...] + * an

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-23 Thread Waiman Long
On 07/22/2013 06:34 AM, Ingo Molnar wrote: * Waiman Longwaiman.l...@hp.com wrote: I had run some performance tests using the fserver and new_fserver benchmarks (on ext4 filesystems) of the AIM7 test suite on a 80-core DL980 with HT on. The following kernels were used: 1. Modified 3.10.1

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-22 Thread Ingo Molnar
* Waiman Long wrote: > I had run some performance tests using the fserver and new_fserver > benchmarks (on ext4 filesystems) of the AIM7 test suite on a 80-core > DL980 with HT on. The following kernels were used: > > 1. Modified 3.10.1 kernel with mb_cache_spinlock in fs/mbcache.c >

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-22 Thread Ingo Molnar
* Waiman Long waiman.l...@hp.com wrote: I had run some performance tests using the fserver and new_fserver benchmarks (on ext4 filesystems) of the AIM7 test suite on a 80-core DL980 with HT on. The following kernels were used: 1. Modified 3.10.1 kernel with mb_cache_spinlock in

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-20 Thread Raghavendra K T
On 07/18/2013 07:49 PM, Waiman Long wrote: On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: [...] + * an increase in lock size is not an issue. So is it

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-20 Thread Raghavendra K T
On 07/18/2013 07:49 PM, Waiman Long wrote: On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: [...] + * an increase in lock size is not an issue. So is it

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/19/2013 05:11 PM, George Spelvin wrote: What I have in mind is to have 2 separate rwlock initializers - one for fair and one for reader-bias behavior. So the lock owners can decide what behavior do they want with a one line change. That's definitely a nicer patch, if it will work. I was

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread George Spelvin
> What I have in mind is to have 2 separate rwlock initializers - one for > fair and one for reader-bias behavior. So the lock owners can decide > what behavior do they want with a one line change. That's definitely a nicer patch, if it will work. I was imagining that, even for a single (type

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/18/2013 02:46 PM, George Spelvin wrote: Thank for the revision, I will make such a change in the next version of my patch. I'm relying on you to correct any technical errors in my description. I just meant "something more like this", not impose that exact wording. As I said in my

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/19/2013 04:40 AM, Ingo Molnar wrote: * Waiman Long wrote: On 07/18/2013 03:42 AM, Ingo Molnar wrote: * Waiman Long wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is faster in high contention situation.

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Ingo Molnar
* Waiman Long wrote: > On 07/18/2013 03:42 AM, Ingo Molnar wrote: > >* Waiman Long wrote: > > > + *stealing the lock if come at the right moment, the granting of the > + *lock is mostly in FIFO order. > + * 2. It is faster in high contention situation. > >>>Again, why is it

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Ingo Molnar
* Waiman Long waiman.l...@hp.com wrote: On 07/18/2013 03:42 AM, Ingo Molnar wrote: * Waiman Longwaiman.l...@hp.com wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is faster in high contention situation.

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/19/2013 04:40 AM, Ingo Molnar wrote: * Waiman Longwaiman.l...@hp.com wrote: On 07/18/2013 03:42 AM, Ingo Molnar wrote: * Waiman Longwaiman.l...@hp.com wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/18/2013 02:46 PM, George Spelvin wrote: Thank for the revision, I will make such a change in the next version of my patch. I'm relying on you to correct any technical errors in my description. I just meant something more like this, not impose that exact wording. As I said in my response

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread George Spelvin
What I have in mind is to have 2 separate rwlock initializers - one for fair and one for reader-bias behavior. So the lock owners can decide what behavior do they want with a one line change. That's definitely a nicer patch, if it will work. I was imagining that, even for a single (type of)

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-19 Thread Waiman Long
On 07/19/2013 05:11 PM, George Spelvin wrote: What I have in mind is to have 2 separate rwlock initializers - one for fair and one for reader-bias behavior. So the lock owners can decide what behavior do they want with a one line change. That's definitely a nicer patch, if it will work. I was

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread George Spelvin
> Thank for the revision, I will make such a change in the next version of > my patch. I'm relying on you to correct any technical errors in my description. I just meant "something more like this", not impose that exact wording. > As I said in my response to Ingo, that change will make the lock

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Waiman Long
On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: Apparently, the regular read/write lock performs even better than the queue read/write lock in some cases.

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Waiman Long
On 07/18/2013 03:42 AM, Ingo Molnar wrote: * Waiman Long wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is faster in high contention situation. Again, why is it faster? The current rwlock implementation suffers

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread George Spelvin
In the interest of more useful Kconfig help, could I recommend the following text: config QUEUE_RWLOCK bool "Generic queue read/write lock" depends on ARCH_QUEUE_RWLOCK help Use an alternative reader-writer lock (rwlock) implementation, optimized for

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Thomas Gleixner
Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: > On 07/15/2013 06:31 PM, Thomas Gleixner wrote: > > On Fri, 12 Jul 2013, Waiman Long wrote: > > > Apparently, the regular read/write lock performs even better than > > > the queue read/write lock in some cases. This is probably due to the > > The

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Ingo Molnar
* Waiman Long wrote: > > > >>+ *stealing the lock if come at the right moment, the granting of the > >>+ *lock is mostly in FIFO order. > >>+ * 2. It is faster in high contention situation. > > > > Again, why is it faster? > > The current rwlock implementation suffers from a thundering

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Ingo Molnar
* Waiman Long waiman.l...@hp.com wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is faster in high contention situation. Again, why is it faster? The current rwlock implementation suffers from a

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Thomas Gleixner
Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: Apparently, the regular read/write lock performs even better than the queue read/write lock in some cases. This is probably due to the The regular

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread George Spelvin
In the interest of more useful Kconfig help, could I recommend the following text: config QUEUE_RWLOCK bool Generic queue read/write lock depends on ARCH_QUEUE_RWLOCK help Use an alternative reader-writer lock (rwlock) implementation, optimized for

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Waiman Long
On 07/18/2013 03:42 AM, Ingo Molnar wrote: * Waiman Longwaiman.l...@hp.com wrote: + *stealing the lock if come at the right moment, the granting of the + *lock is mostly in FIFO order. + * 2. It is faster in high contention situation. Again, why is it faster? The current rwlock

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread Waiman Long
On 07/18/2013 06:22 AM, Thomas Gleixner wrote: Waiman, On Mon, 15 Jul 2013, Waiman Long wrote: On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: Apparently, the regular read/write lock performs even better than the queue read/write lock in some cases.

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-18 Thread George Spelvin
Thank for the revision, I will make such a change in the next version of my patch. I'm relying on you to correct any technical errors in my description. I just meant something more like this, not impose that exact wording. As I said in my response to Ingo, that change will make the lock more

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Waiman Long
On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: In term of single-thread performance (no contention), a 256K lock/unlock loop was run on a 2.4GHz Westmere x86-64 CPU. The following table shows the average time for a single lock/unlock sequence: Lock Type

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Thomas Gleixner
On Fri, 12 Jul 2013, Waiman Long wrote: > This patch introduces a read/write lock implementation that put waiting > readers and writers into a queue instead of actively contending the > lock like the regular read/write lock. This will improve performance in > highly contended situation by

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Waiman Long
On 07/15/2013 10:39 AM, Steven Rostedt wrote: On Fri, 2013-07-12 at 21:34 -0400, Waiman Long wrote: Signed-off-by: Waiman Long --- +/* + * The queue read/write lock data structure + * The reader stealing flag, if sea,t will enable reader at the head of the "sea,t"? Should be "if set,".

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Steven Rostedt
On Fri, 2013-07-12 at 21:34 -0400, Waiman Long wrote: > Signed-off-by: Waiman Long > --- > include/asm-generic/qrwlock.h | 124 + > lib/Kconfig | 11 ++ > lib/Makefile |1 + > lib/qrwlock.c | 246 >

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Steven Rostedt
On Fri, 2013-07-12 at 21:34 -0400, Waiman Long wrote: Signed-off-by: Waiman Long waiman.l...@hp.com --- include/asm-generic/qrwlock.h | 124 + lib/Kconfig | 11 ++ lib/Makefile |1 + lib/qrwlock.c | 246

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Waiman Long
On 07/15/2013 10:39 AM, Steven Rostedt wrote: On Fri, 2013-07-12 at 21:34 -0400, Waiman Long wrote: Signed-off-by: Waiman Longwaiman.l...@hp.com --- +/* + * The queue read/write lock data structure + * The reader stealing flag, if sea,t will enable reader at the head of the sea,t? Should

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Thomas Gleixner
On Fri, 12 Jul 2013, Waiman Long wrote: This patch introduces a read/write lock implementation that put waiting readers and writers into a queue instead of actively contending the lock like the regular read/write lock. This will improve performance in highly contended situation by reducing

Re: [PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-15 Thread Waiman Long
On 07/15/2013 06:31 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2013, Waiman Long wrote: In term of single-thread performance (no contention), a 256K lock/unlock loop was run on a 2.4GHz Westmere x86-64 CPU. The following table shows the average time for a single lock/unlock sequence: Lock Type

[PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-12 Thread Waiman Long
This patch introduces a read/write lock implementation that put waiting readers and writers into a queue instead of actively contending the lock like the regular read/write lock. This will improve performance in highly contended situation by reducing the cache line bouncing effect. In addition,

[PATCH RFC 1/2] qrwlock: A queue read/write lock implementation

2013-07-12 Thread Waiman Long
This patch introduces a read/write lock implementation that put waiting readers and writers into a queue instead of actively contending the lock like the regular read/write lock. This will improve performance in highly contended situation by reducing the cache line bouncing effect. In addition,