Re: [PATCH 2/2] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

2019-07-01 Thread Michel Lespinasse
I don't like adding additional levels of macros to build the augmented rbtree callbacks. OTOH, all of the existing callbacks compute the max (within the subtree) of a per-node scalar property. So, I guess I could do a RB_DECLARE_MAX_CALLBACKS, and one of its arguments would tell it how to compute t

Re: [PATCH 2/2] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

2019-07-01 Thread Peter Zijlstra
On Mon, Jul 01, 2019 at 09:46:30AM +0200, Peter Zijlstra wrote: > On Fri, Jun 28, 2019 at 05:49:52PM -0700, Michel Lespinasse wrote: > > The motivation for this change is that I want to introduce augmented rbtree > > uses where the augmented data for the subtree is a struct instead of a > > scala

Re: [PATCH 2/2] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

2019-07-01 Thread Peter Zijlstra
On Fri, Jun 28, 2019 at 05:49:52PM -0700, Michel Lespinasse wrote: > - Change the definition of the RBCOMPUTE function. The propagate > callback repeatedly calls RBCOMPUTE as it moves from leaf to root. > it wants to stop recomputing once the augmented subtree information > doesn't change. Th

Re: [PATCH 2/2] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

2019-07-01 Thread Peter Zijlstra
On Fri, Jun 28, 2019 at 05:49:52PM -0700, Michel Lespinasse wrote: > --- a/tools/include/linux/rbtree_augmented.h > +++ b/tools/include/linux/rbtree_augmented.h > @@ -74,39 +74,48 @@ rb_insert_augmented_cached(struct rb_node *node, > newleft, &root->rb_leftmost, augment-

[PATCH 2/2] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

2019-06-28 Thread Michel Lespinasse
- Change the definition of the RBCOMPUTE function. The propagate callback repeatedly calls RBCOMPUTE as it moves from leaf to root. it wants to stop recomputing once the augmented subtree information doesn't change. This was previously checked using the == operator, but that only works when