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

2013-11-18 Thread Long, Wai Man
iling 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

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 perfo

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 ordere

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 sti

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 ha

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 this

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

2013-11-12 Thread Waiman Long
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 this, fair variants of lock initializers are added by this patch