Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Michel Lespinasse
On Mon, Aug 6, 2012 at 8:38 AM, Peter Zijlstra wrote: > On Mon, 2012-08-06 at 16:17 +0200, Peter Zijlstra wrote: > >> Why would every user need to replicate the propagate and rotate >> boilerplate? > > So I don't have a tree near that any of this applies to (hence no actual > patch) All right, he

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Michel Lespinasse
On Mon, Aug 6, 2012 at 7:29 AM, Peter Zijlstra wrote: > On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: >> +void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, >> + void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) >> +{ >> + __rb_insert(n

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Peter Zijlstra
On Mon, 2012-08-06 at 14:34 -0700, Michel Lespinasse wrote: > On Mon, Aug 6, 2012 at 7:25 AM, Peter Zijlstra wrote: > > On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: > >> +struct rb_augment_callbacks { > >> + void (*propagate)(struct rb_node *node, struct rb_node *stop); > >> +

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Michel Lespinasse
On Mon, Aug 6, 2012 at 7:25 AM, Peter Zijlstra wrote: > On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: >> +struct rb_augment_callbacks { >> + void (*propagate)(struct rb_node *node, struct rb_node *stop); >> + void (*copy)(struct rb_node *old, struct rb_node *new); >> +

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Peter Zijlstra
On Mon, 2012-08-06 at 16:17 +0200, Peter Zijlstra wrote: > Why would every user need to replicate the propagate and rotate > boilerplate? So I don't have a tree near that any of this applies to (hence no actual patch), but why can't we have something like: struct rb_augment_callback { co

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Peter Zijlstra
On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: > +void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, > + void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) > +{ > + __rb_insert(node, root, augment_rotate); > +} > +EXPORT_SYMBOL(__rb_insert

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Peter Zijlstra
On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: > +struct rb_augment_callbacks { > + void (*propagate)(struct rb_node *node, struct rb_node *stop); > + void (*copy)(struct rb_node *old, struct rb_node *new); > + void (*rotate)(struct rb_node *old, struct rb_node *new);

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-06 Thread Peter Zijlstra
On Thu, 2012-08-02 at 15:34 -0700, Michel Lespinasse wrote: > +static void augment_propagate(struct rb_node *rb, struct rb_node *stop) > +{ > + while (rb != stop) { > + struct interval_tree_node *node = > + rb_entry(rb, struct interval_tree_node, rb); > +

Re: [PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-05 Thread Rik van Riel
On 08/02/2012 06:34 PM, Michel Lespinasse wrote: Introduce new augmented rbtree APIs that allow minimal recalculation of augmented node information. A new callback is added to the rbtree insertion and erase rebalancing functions, to be called on each tree rotations. Such rotations preserve the s

[PATCH v2 8/9] rbtree: faster augmented rbtree manipulation

2012-08-02 Thread Michel Lespinasse
Introduce new augmented rbtree APIs that allow minimal recalculation of augmented node information. A new callback is added to the rbtree insertion and erase rebalancing functions, to be called on each tree rotations. Such rotations preserve the subtree's root augmented value, but require recalcul