Re: Question regarding Linux implementation of rbtrees

2017-04-14 Thread Alexandru Moise
On Fri, Apr 14, 2017 at 10:51:32AM +0200, Peter Zijlstra wrote: > On Fri, Apr 14, 2017 at 12:24:55AM +0200, Alexandru Moise wrote: > > Seeing as RB_RED is defined to be 0 in include/linux/rbtree_augmented.h > > A call of this form: rb_set_parent_color(node, parent, RB_RED); > > as seen in __rb_inse

Re: Question regarding Linux implementation of rbtrees

2017-04-14 Thread Peter Zijlstra
On Fri, Apr 14, 2017 at 12:24:55AM +0200, Alexandru Moise wrote: > Seeing as RB_RED is defined to be 0 in include/linux/rbtree_augmented.h > A call of this form: rb_set_parent_color(node, parent, RB_RED); > as seen in __rb_insert would only end up reassigning the parent "color" > (which is the pare

Question regarding Linux implementation of rbtrees

2017-04-13 Thread Alexandru Moise
Seeing as RB_RED is defined to be 0 in include/linux/rbtree_augmented.h A call of this form: rb_set_parent_color(node, parent, RB_RED); as seen in __rb_insert would only end up reassigning the parent "color" (which is the parent pointer value cast to unsigned long) OR'd with 0. Which would mean tha