]> git.karo-electronics.de Git - karo-tx-linux.git/commit
rbtree: optimize fetching of sibling node
authorMichel Lespinasse <walken@google.com>
Tue, 14 Aug 2012 03:22:43 +0000 (13:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 24 Aug 2012 06:43:54 +0000 (16:43 +1000)
commit44cc94dec4a5e2f54fd73c6be772a06c5ca1dc47
treece73b24235b792cc15d5973ecf0b0a846362fa44
parent149287e16b0ea1b656accafa04950d0418b85f74
rbtree: optimize fetching of sibling node

When looking to fetch a node's sibling, we went through a sequence of:
- check if node is the parent's left child
- if it is, then fetch the parent's right child

This can be replaced with:
- fetch the parent's right child as an assumed sibling
- check that node is NOT the fetched child

This avoids fetching the parent's left child when node is actually
that child. Saves a bit on code size, though it doesn't seem to make
a large difference in speed.

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Daniel Santos <daniel.santos@pobox.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/rbtree.c