rbtree: optimize fetching of sibling node
authorMichel Lespinasse <walken@google.com>
Wed, 3 Jan 2018 11:40:52 +0000 (12:40 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Jan 2018 11:40:52 +0000 (12:40 +0100)
commitea32b54fda4b26ac8298a0d7e40554f85b414a39
tree921bba7ec9d277612b41520aa1d8477379485d1c
parent253b4e354bcda1d5b998060f107ea3e6372c0252
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>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Linux commit 59633abf34e2f44b8e772a2c12a92132aa7c2220]

Ported to Xen.

Signed-off-by: Praveen Kumar <kpraveen.lkml@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/common/rbtree.c