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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
> +               unsigned long subtree_last = compute_subtree_last(node);
> +               if (node->__subtree_last == subtree_last)
> +                       break;
> +               node->__subtree_last = subtree_last;
> +               rb = rb_parent(&node->rb);
> +       }
> +}
> +
> +static void augment_copy(struct rb_node *rb_old, struct rb_node *rb_new)
> +{
> +       struct interval_tree_node *old =
> +               rb_entry(rb_old, struct interval_tree_node, rb);
> +       struct interval_tree_node *new =
> +               rb_entry(rb_new, struct interval_tree_node, rb);
> +
> +       new->__subtree_last = old->__subtree_last;
> +}
> +
> +static void augment_rotate(struct rb_node *rb_old, struct rb_node *rb_new)
> +{
> +       struct interval_tree_node *old =
> +               rb_entry(rb_old, struct interval_tree_node, rb);
> +       struct interval_tree_node *new =
> +               rb_entry(rb_new, struct interval_tree_node, rb);
> +
> +       new->__subtree_last = old->__subtree_last;
> +       old->__subtree_last = compute_subtree_last(old);
> +} 

I still don't get why we need the 3 callbacks when both propagate and
rotate are simple variants of the original callback
(compute_subtree_last, in this instance).

Why would every user need to replicate the propagate and rotate
boilerplate?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]