Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-04 Thread Davidlohr Bueso
On Mon, 03 Apr 2017, Jan Kara wrote: Or just a plain sequence counter of the lock operations? So what I dislike about this is that we'd also have to enlarge the struct range_rwlock_tree. otoh, I'm hesitant to depend on the tick rate for lock correctness, so perhaps your suggestion is best.

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-04 Thread Davidlohr Bueso
On Mon, 03 Apr 2017, Jan Kara wrote: Or just a plain sequence counter of the lock operations? So what I dislike about this is that we'd also have to enlarge the struct range_rwlock_tree. otoh, I'm hesitant to depend on the tick rate for lock correctness, so perhaps your suggestion is best.

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Jan Kara
On Mon 03-04-17 08:26:43, Davidlohr Bueso wrote: > On Mon, 03 Apr 2017, Laurent Dufour wrote: > >Le Tue, 28 Mar 2017 09:39:18 -0700, > >Davidlohr Bueso a écrit : > >>I'll wait to see if there are any more concerns and send a v2 with > >>your corrections. > > > >Hi Bavidlohr, I

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Jan Kara
On Mon 03-04-17 08:26:43, Davidlohr Bueso wrote: > On Mon, 03 Apr 2017, Laurent Dufour wrote: > >Le Tue, 28 Mar 2017 09:39:18 -0700, > >Davidlohr Bueso a écrit : > >>I'll wait to see if there are any more concerns and send a v2 with > >>your corrections. > > > >Hi Bavidlohr, I think there is a

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Davidlohr Bueso
On Mon, 03 Apr 2017, Laurent Dufour wrote: Le Tue, 28 Mar 2017 09:39:18 -0700, Davidlohr Bueso a écrit : I'll wait to see if there are any more concerns and send a v2 with your corrections. Hi Bavidlohr, I think there is a major issue regarding the task catching a signal

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Davidlohr Bueso
On Mon, 03 Apr 2017, Laurent Dufour wrote: Le Tue, 28 Mar 2017 09:39:18 -0700, Davidlohr Bueso a écrit : I'll wait to see if there are any more concerns and send a v2 with your corrections. Hi Bavidlohr, I think there is a major issue regarding the task catching a signal in

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Laurent Dufour
Le Tue, 28 Mar 2017 09:39:18 -0700, Davidlohr Bueso a écrit : > I'll wait to see if there are any more concerns and send a v2 with > your corrections. Hi Bavidlohr, I think there is a major issue regarding the task catching a signal in wait_for_range(). I can see it when a

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-04-03 Thread Laurent Dufour
Le Tue, 28 Mar 2017 09:39:18 -0700, Davidlohr Bueso a écrit : > I'll wait to see if there are any more concerns and send a v2 with > your corrections. Hi Bavidlohr, I think there is a major issue regarding the task catching a signal in wait_for_range(). I can see it when a thread is catching a

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-30 Thread Davidlohr Bueso
On 2017-03-30 07:56, Laurent Dufour wrote: On 07/03/2017 06:03, Davidlohr Bueso wrote: +static inline int wait_for_ranges(struct range_rwlock_tree *tree, + struct range_rwlock *lock, long state) +{ + int ret = 0; + + while (true) { +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-30 Thread Davidlohr Bueso
On 2017-03-30 07:56, Laurent Dufour wrote: On 07/03/2017 06:03, Davidlohr Bueso wrote: +static inline int wait_for_ranges(struct range_rwlock_tree *tree, + struct range_rwlock *lock, long state) +{ + int ret = 0; + + while (true) { +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-30 Thread Laurent Dufour
On 07/03/2017 06:03, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking > involves

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-30 Thread Laurent Dufour
On 07/03/2017 06:03, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking > involves

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Kirill A. Shutemov wrote: On Wed, Mar 29, 2017 at 08:31:33AM -0700, Davidlohr Bueso wrote: On Wed, 29 Mar 2017, Laurent Dufour wrote: > On 28/03/2017 18:58, Kirill A. Shutemov wrote: > > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > > > I'll wait to

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Kirill A. Shutemov wrote: On Wed, Mar 29, 2017 at 08:31:33AM -0700, Davidlohr Bueso wrote: On Wed, 29 Mar 2017, Laurent Dufour wrote: > On 28/03/2017 18:58, Kirill A. Shutemov wrote: > > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > > > I'll wait to

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Kirill A. Shutemov
On Wed, Mar 29, 2017 at 08:31:33AM -0700, Davidlohr Bueso wrote: > On Wed, 29 Mar 2017, Laurent Dufour wrote: > > > On 28/03/2017 18:58, Kirill A. Shutemov wrote: > > > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > > > > I'll wait to see if there are any more concerns and

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Kirill A. Shutemov
On Wed, Mar 29, 2017 at 08:31:33AM -0700, Davidlohr Bueso wrote: > On Wed, 29 Mar 2017, Laurent Dufour wrote: > > > On 28/03/2017 18:58, Kirill A. Shutemov wrote: > > > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > > > > I'll wait to see if there are any more concerns and

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Laurent Dufour wrote: On 28/03/2017 18:58, Kirill A. Shutemov wrote: On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: I'll wait to see if there are any more concerns and send a v2 with your corrections. Have you tried drop-in replacement of mmap_sem

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Laurent Dufour wrote: On 28/03/2017 18:58, Kirill A. Shutemov wrote: On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: I'll wait to see if there are any more concerns and send a v2 with your corrections. Have you tried drop-in replacement of mmap_sem

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: +static __always_inline int +__range_read_lock_common(struct range_rwlock_tree *tree, +struct range_rwlock *lock, long state) +{ + struct interval_tree_node

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: +static __always_inline int +__range_read_lock_common(struct range_rwlock_tree *tree, +struct range_rwlock *lock, long state) +{ + struct interval_tree_node

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 88e01e08e279..e4d9eadd2c47 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -154,7 +154,6 @@

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 88e01e08e279..e4d9eadd2c47 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -154,7 +154,6 @@

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: +#define RANGE_RWLOCK_INFINITY (~0UL - 1) +#define DEFINE_RANGE_RWLOCK_INF(name) \ + struct range_rwlock name = __RANGE_RWLOCK_INITIALIZER(0, RANGE_RWLOCK_INFINITY)

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Davidlohr Bueso
On Wed, 29 Mar 2017, Peter Zijlstra wrote: On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: +#define RANGE_RWLOCK_INFINITY (~0UL - 1) +#define DEFINE_RANGE_RWLOCK_INF(name) \ + struct range_rwlock name = __RANGE_RWLOCK_INITIALIZER(0, RANGE_RWLOCK_INFINITY)

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +static __always_inline int > +__range_read_lock_common(struct range_rwlock_tree *tree, > + struct range_rwlock *lock, long state) > +{ > + struct interval_tree_node *node; > + unsigned long flags; > +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +static __always_inline int > +__range_read_lock_common(struct range_rwlock_tree *tree, > + struct range_rwlock *lock, long state) > +{ > + struct interval_tree_node *node; > + unsigned long flags; > +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +EXPORT_SYMBOL(range_rwlock_init); > +EXPORT_SYMBOL(range_rwlock_init_inf); > +EXPORT_SYMBOL(range_read_lock); > +EXPORT_SYMBOL(range_read_lock_interruptible); > +EXPORT_SYMBOL(range_read_lock_killable); >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +EXPORT_SYMBOL(range_rwlock_init); > +EXPORT_SYMBOL(range_rwlock_init_inf); > +EXPORT_SYMBOL(range_read_lock); > +EXPORT_SYMBOL(range_read_lock_interruptible); > +EXPORT_SYMBOL(range_read_lock_killable); >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +static __always_inline int > +__range_read_lock_common(struct range_rwlock_tree *tree, > + struct range_rwlock *lock, long state) > +{ > + struct interval_tree_node *node; > + unsigned long flags; > +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +static __always_inline int > +__range_read_lock_common(struct range_rwlock_tree *tree, > + struct range_rwlock *lock, long state) > +{ > + struct interval_tree_node *node; > + unsigned long flags; > +

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +/* > + * Implementation of read/write range locks. > + * > + * We keep interval tree of locked and to-be-locked ranges. When new range > lock > + * is requested, we add its interval to the tree and store number of > intervals >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +/* > + * Implementation of read/write range locks. > + * > + * We keep interval tree of locked and to-be-locked ranges. When new range > lock > + * is requested, we add its interval to the tree and store number of > intervals >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +#define RANGE_RWLOCK_INFINITY (~0UL - 1) > +#define DEFINE_RANGE_RWLOCK_INF(name)\ > + struct range_rwlock name = __RANGE_RWLOCK_INITIALIZER(0, > RANGE_RWLOCK_INFINITY) > +void range_rwlock_init_inf(struct

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +#define RANGE_RWLOCK_INFINITY (~0UL - 1) > +#define DEFINE_RANGE_RWLOCK_INF(name)\ > + struct range_rwlock name = __RANGE_RWLOCK_INITIALIZER(0, > RANGE_RWLOCK_INFINITY) > +void range_rwlock_init_inf(struct

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +++ b/kernel/locking/range_rwlock.c > @@ -0,0 +1,462 @@ > +/* > + * Implementation of read/write range locks. > + * > + * We keep interval tree of locked and to-be-locked ranges. When new range > lock > + * is requested, we add

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > +++ b/kernel/locking/range_rwlock.c > @@ -0,0 +1,462 @@ > +/* > + * Implementation of read/write range locks. > + * > + * We keep interval tree of locked and to-be-locked ranges. When new range > lock > + * is requested, we add

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index 88e01e08e279..e4d9eadd2c47 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -154,7 +154,6 @@ config DRM_RADEON > select HWMON >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Peter Zijlstra
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index 88e01e08e279..e4d9eadd2c47 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -154,7 +154,6 @@ config DRM_RADEON > select HWMON >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Laurent Dufour
On 28/03/2017 18:58, Kirill A. Shutemov wrote: > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: >> I'll wait to see if there are any more concerns and send a v2 with your >> corrections. > > Have you tried drop-in replacement of mmap_sem with full range lock? > It would be

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-29 Thread Laurent Dufour
On 28/03/2017 18:58, Kirill A. Shutemov wrote: > On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: >> I'll wait to see if there are any more concerns and send a v2 with your >> corrections. > > Have you tried drop-in replacement of mmap_sem with full range lock? > It would be

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Kirill A. Shutemov
On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > I'll wait to see if there are any more concerns and send a v2 with your > corrections. Have you tried drop-in replacement of mmap_sem with full range lock? It would be interesting to see performance implication for this. --

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Kirill A. Shutemov
On Tue, Mar 28, 2017 at 09:39:18AM -0700, Davidlohr Bueso wrote: > I'll wait to see if there are any more concerns and send a v2 with your > corrections. Have you tried drop-in replacement of mmap_sem with full range lock? It would be interesting to see performance implication for this. --

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Davidlohr Bueso
On Tue, 28 Mar 2017, Laurent Dufour wrote: +#define __RANGE_RWLOCK_INITIALIZER(start, last) { \ + .node = { \ + .start = (start)\ + ,.last = (last) \ + }

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Davidlohr Bueso
On Tue, 28 Mar 2017, Laurent Dufour wrote: +#define __RANGE_RWLOCK_INITIALIZER(start, last) { \ + .node = { \ + .start = (start)\ + ,.last = (last) \ + }

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Laurent Dufour
On 07/03/2017 06:03, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking > involves

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-28 Thread Laurent Dufour
On 07/03/2017 06:03, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking > involves

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-09 Thread Jan Kara
Hi! On Mon 06-03-17 21:03:26, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking >

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-09 Thread Jan Kara
Hi! On Mon 06-03-17 21:03:26, Davidlohr Bueso wrote: > This implements a sleepable range rwlock, based on interval tree, serializing > conflicting/intersecting/overlapping ranges within the tree. The largest range > is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking >

[PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-06 Thread Davidlohr Bueso
This implements a sleepable range rwlock, based on interval tree, serializing conflicting/intersecting/overlapping ranges within the tree. The largest range is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking involves dealing with the tree itself and the range to be

[PATCH 1/5] locking: Introduce range reader/writer lock

2017-03-06 Thread Davidlohr Bueso
This implements a sleepable range rwlock, based on interval tree, serializing conflicting/intersecting/overlapping ranges within the tree. The largest range is given by [0, ~0 - 1] (inclusive). Unlike traditional locks, range locking involves dealing with the tree itself and the range to be