Re: [PATCH 4/6] rbtree: faster augmented insert

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

 



On Fri, 2012-07-20 at 05:31 -0700, Michel Lespinasse wrote:
> +static void augment_rotate(struct rb_node *rb_old, struct rb_node *rb_new)
> +{
> +       struct test_node *old = rb_entry(rb_old, struct test_node, rb);
> +       struct test_node *new = rb_entry(rb_new, struct test_node, rb);
> +
> +       /* Rotation doesn't change subtree's augmented value */
> +       new->augmented = old->augmented;
> +       old->augmented = augment_recompute(old);
> +} 

> +static inline void augment_propagate(struct rb_node *rb)
> +{
> +       while (rb) {
> +               struct test_node *node = rb_entry(rb, struct test_node, rb);
> +               node->augmented = augment_recompute(node);
> +               rb = rb_parent(&node->rb);
> +       }
> +}

So why do we have to introduce these two new function pointers to pass
along when they can both be trivially expressed in the old single
augment function?


--
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]