rbtree: low level optimizations in __rb_erase_color()
authorMichel Lespinasse <walken@google.com>
Wed, 20 Dec 2017 17:03:51 +0000 (18:03 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 20 Dec 2017 17:03:51 +0000 (18:03 +0100)
commitb695189a016a6fc32277fd1158a1421dd359758e
treeb9c28e7c401236408523535d44fd7f66584c6d42
parentea9733f4aec3b6f4d800fd9e4287e4fc3812c4a3
rbtree: low level optimizations in __rb_erase_color()

In __rb_erase_color(), we often already have pointers to the nodes being
rotated and/or know what their colors must be, so we can generate more
efficient code than the generic __rb_rotate_left() and __rb_rotate_right()
functions.

Also when the current node is red or when flipping the sibling's color,
the parent is already known so we can use the more efficient
rb_set_parent_color() function to set the desired color.

Signed-off-by: Michel Lespinasse <walken@google.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Linux commit 6280d2356fd8ad0936a63c10dc1e6accf48d0c61]

Ported to Xen.

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