lkml.org 
[lkml]   [2019]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] rbtree: fix the red root
On Fri, Jan 11, 2019 at 03:58:43PM -0500, Qian Cai wrote:
> diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c
> index b7055b2a07d3..afad0213a117 100644
> --- a/lib/rbtree_test.c
> +++ b/lib/rbtree_test.c
> @@ -345,6 +345,17 @@ static int __init rbtree_test_init(void)
> check(0);
> }
>
> + /*
> + * a little regression test to catch a bug may be introduced by
> + * 6d58452dc06 (rbtree: adjust root color in rb_insert_color() only when
> + * necessary)
> + */
> + insert(nodes, &root);
> + nodes->rb.__rb_parent_color = RB_RED;
> + insert(nodes + 1, &root);
> + erase(nodes + 1, &root);
> + erase(nodes, &root);

That's not a fair test! You're poking around in the data structure to
create the situation. This test would have failed before 6d58452dc06 too.
How do we create a tree that has a red parent at root, only using insert()
and erase()?

\
 
 \ /
  Last update: 2019-01-12 00:17    [W:0.063 / U:3.392 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site