RE: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Long, Wai Man
List; Peter Zijlstra; Steven Rostedt; Andrew Morton; Michel Lespinasse; Andi Kleen; Rik van Riel; Paul E. McKenney; Raghavendra K T; George Spelvin; Tim Chen; Chandramouleeswaran, Aswin; Norton, Scott J Subject: Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock On Tue, Nov 12, 2013 at 6

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Mon, Nov 18, 2013 at 10:46 AM, Andi Kleen wrote: >> Why would it make sense here? > > There may be cases were switching all read locks to unfair may make > concerete workloads slower. Sorry, but I don't believe in "may be" as an excuse for complexity. Especially since the "may be" faster

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Andi Kleen
> Why would it make sense here? There may be cases were switching all read locks to unfair may make concerete workloads slower. The effect is very visible in (non kernel) lock micro benchmarks, especially with HyperThreading. With very high contention or long enough critical sections the

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Mon, Nov 18, 2013 at 10:34 AM, Andi Kleen wrote: > > FWIW unfair can be faster in some cases. It depends on the workload. Sure. And we've never cared before. When we switched over to the ticket spinlocks, we actually had *numbers* about how the old unfair spinlocks could be faster. And we

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Andi Kleen
On Mon, Nov 18, 2013 at 10:11:48AM -0800, Linus Torvalds wrote: > On Tue, Nov 12, 2013 at 6:48 AM, Waiman Long wrote: > > By default, queue rwlock is fair among writers and gives preference > > to readers allowing them to steal lock even if a writer is > > waiting. However, there is a desire to

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Tue, Nov 12, 2013 at 6:48 AM, Waiman Long wrote: > By default, queue rwlock is fair among writers and gives preference > to readers allowing them to steal lock even if a writer is > waiting. However, there is a desire to have a fair variant of > rwlock that is more deterministic. To enable

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Tue, Nov 12, 2013 at 6:48 AM, Waiman Long waiman.l...@hp.com wrote: By default, queue rwlock is fair among writers and gives preference to readers allowing them to steal lock even if a writer is waiting. However, there is a desire to have a fair variant of rwlock that is more deterministic.

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Andi Kleen
On Mon, Nov 18, 2013 at 10:11:48AM -0800, Linus Torvalds wrote: On Tue, Nov 12, 2013 at 6:48 AM, Waiman Long waiman.l...@hp.com wrote: By default, queue rwlock is fair among writers and gives preference to readers allowing them to steal lock even if a writer is waiting. However, there is a

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Mon, Nov 18, 2013 at 10:34 AM, Andi Kleen a...@firstfloor.org wrote: FWIW unfair can be faster in some cases. It depends on the workload. Sure. And we've never cared before. When we switched over to the ticket spinlocks, we actually had *numbers* about how the old unfair spinlocks could be

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Andi Kleen
Why would it make sense here? There may be cases were switching all read locks to unfair may make concerete workloads slower. The effect is very visible in (non kernel) lock micro benchmarks, especially with HyperThreading. With very high contention or long enough critical sections the

Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Linus Torvalds
On Mon, Nov 18, 2013 at 10:46 AM, Andi Kleen a...@firstfloor.org wrote: Why would it make sense here? There may be cases were switching all read locks to unfair may make concerete workloads slower. Sorry, but I don't believe in may be as an excuse for complexity. Especially since the may be

RE: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock

2013-11-18 Thread Long, Wai Man
List; Peter Zijlstra; Steven Rostedt; Andrew Morton; Michel Lespinasse; Andi Kleen; Rik van Riel; Paul E. McKenney; Raghavendra K T; George Spelvin; Tim Chen; Chandramouleeswaran, Aswin; Norton, Scott J Subject: Re: [PATCH v6 3/5] qrwlock: Enable fair queue read/write lock On Tue, Nov 12, 2013 at 6