Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Peter Zijlstra
On Thu, Apr 30, 2020 at 10:46:17AM +0200, Peter Zijlstra wrote: > On Wed, Apr 29, 2020 at 06:04:05PM -0700, Michel Lespinasse wrote: > > - Have you considered passing a cmp() function to rb_add() and > > rb_add_cached(), and having these test cmp() < 0 rather than less() ? > > I figure every

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Peter Zijlstra
On Wed, Apr 29, 2020 at 06:04:05PM -0700, Michel Lespinasse wrote: > Hi Peter, > > On Wed, Apr 29, 2020 at 05:32:59PM +0200, Peter Zijlstra wrote: > > I've always been bothered by the endless (fragile) boilerplate for > > rbtree, and I recently wrote some rbtree helpers for objtool and > >

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Peter Zijlstra
On Thu, Apr 30, 2020 at 12:51:02AM -0700, Michel Lespinasse wrote: > On Thu, Apr 30, 2020 at 12:28 AM Juri Lelli wrote: > > > --- a/include/linux/rbtree.h > > > +++ b/include/linux/rbtree.h > > > @@ -141,12 +141,18 @@ static inline void rb_insert_color_cache > > > rb_insert_color(node,

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Juri Lelli
On 30/04/20 00:51, Michel Lespinasse wrote: > On Thu, Apr 30, 2020 at 12:28 AM Juri Lelli wrote: > > > --- a/include/linux/rbtree.h > > > +++ b/include/linux/rbtree.h > > > @@ -141,12 +141,18 @@ static inline void rb_insert_color_cache > > > rb_insert_color(node, >rb_root); > > > } > > > >

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Michel Lespinasse
On Thu, Apr 30, 2020 at 12:28 AM Juri Lelli wrote: > > --- a/include/linux/rbtree.h > > +++ b/include/linux/rbtree.h > > @@ -141,12 +141,18 @@ static inline void rb_insert_color_cache > > rb_insert_color(node, >rb_root); > > } > > > > -static inline void rb_erase_cached(struct rb_node

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-30 Thread Juri Lelli
Hi, On 29/04/20 17:32, Peter Zijlstra wrote: > I've always been bothered by the endless (fragile) boilerplate for > rbtree, and I recently wrote some rbtree helpers for objtool and > figured I should lift them into the kernel and use them more widely. > > Provide: > > partial-order; less()

Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-29 Thread Michel Lespinasse
Hi Peter, On Wed, Apr 29, 2020 at 05:32:59PM +0200, Peter Zijlstra wrote: > I've always been bothered by the endless (fragile) boilerplate for > rbtree, and I recently wrote some rbtree helpers for objtool and > figured I should lift them into the kernel and use them more widely. > > Provide: >

[RFC][PATCH 1/7] rbtree: Add generic add and find helpers

2020-04-29 Thread Peter Zijlstra
I've always been bothered by the endless (fragile) boilerplate for rbtree, and I recently wrote some rbtree helpers for objtool and figured I should lift them into the kernel and use them more widely. Provide: partial-order; less() based: - rb_add(): add a new entry to the rbtree -