lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 27 Jul 2012 14:55:46 -0700
From:	Michel Lespinasse <walken@...gle.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	riel@...hat.com, daniel.santos@...ox.com, aarcange@...hat.com,
	dwmw2@...radead.org, akpm@...ux-foundation.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] rbtree: faster augmented insert

On Fri, Jul 27, 2012 at 1:04 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> 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?

Its because augment_rotate() needs to be a static function that we can
take the address of and pass along as a callback to the tree
rebalancing functions, while augment_propagate() needs to be an inline
function that gets compiled within an __rb_erase() variant for a given
type of augmented rbtree.

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ