Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-02-11 Thread Srivatsa S. Bhat
On 02/11/2013 06:11 PM, David Howells wrote: > Srivatsa S. Bhat wrote: > >> We can use global rwlocks as shown below safely, without fear of deadlocks: >> >> Readers: >> >> CPU 0CPU 1 >> -- -- >> >> 1.spin

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-02-11 Thread David Howells
Srivatsa S. Bhat wrote: > We can use global rwlocks as shown below safely, without fear of deadlocks: > > Readers: > > CPU 0CPU 1 > -- -- > > 1.spin_lock(&random_lock); read_lock(&my_rwlock)

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-24 Thread Oleg Nesterov
On 01/23, Michel Lespinasse wrote: > > On Tue, Jan 22, 2013 at 11:32 AM, Steven Rostedt wrote: > > > > I thought global locks are now fair. That is, a reader will block if a > > writer is waiting. Hence, the above should deadlock on the current > > rwlock_t types. > > I believe you are mistaken he

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-23 Thread Michel Lespinasse
On Tue, Jan 22, 2013 at 11:32 AM, Steven Rostedt wrote: > On Tue, 2013-01-22 at 13:03 +0530, Srivatsa S. Bhat wrote: >> A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer >> locks can also lead to too many deadlock possibilities which can make it very >> hard/impossible

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-22 Thread Stephen Hemminger
On Tue, 22 Jan 2013 13:03:22 +0530 "Srivatsa S. Bhat" wrote: > A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer > locks can also lead to too many deadlock possibilities which can make it very > hard/impossible to use. This is explained in the example below, which help

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-22 Thread Steven Rostedt
On Wed, 2013-01-23 at 01:28 +0530, Srivatsa S. Bhat wrote: > > I thought global locks are now fair. That is, a reader will block if a > > writer is waiting. Hence, the above should deadlock on the current > > rwlock_t types. > > > > Oh is it? Last I checked, lockdep didn't complain about this AB

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-22 Thread Srivatsa S. Bhat
On 01/23/2013 01:02 AM, Steven Rostedt wrote: > On Tue, 2013-01-22 at 13:03 +0530, Srivatsa S. Bhat wrote: >> A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer >> locks can also lead to too many deadlock possibilities which can make it very >> hard/impossible to use. Thi

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-22 Thread Srivatsa S. Bhat
On 01/23/2013 12:15 AM, Stephen Hemminger wrote: > On Tue, 22 Jan 2013 13:03:22 +0530 > "Srivatsa S. Bhat" wrote: > >> A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer >> locks can also lead to too many deadlock possibilities which can make it very >> hard/impossible

Re: [PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-22 Thread Steven Rostedt
On Tue, 2013-01-22 at 13:03 +0530, Srivatsa S. Bhat wrote: > A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer > locks can also lead to too many deadlock possibilities which can make it very > hard/impossible to use. This is explained in the example below, which helps >

[PATCH v5 01/45] percpu_rwlock: Introduce the global reader-writer lock backend

2013-01-21 Thread Srivatsa S. Bhat
A straight-forward (and obvious) algorithm to implement Per-CPU Reader-Writer locks can also lead to too many deadlock possibilities which can make it very hard/impossible to use. This is explained in the example below, which helps justify the need for a different algorithm to implement flexible Pe