linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, esploit@protonmail.ch,
	jejb@linux.ibm.com, dgilbert@interlog.com,
	martin.petersen@oracle.com, joeypabalinas@gmail.com,
	walken@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rbtree: fix the red root
Date: Fri, 11 Jan 2019 19:18:55 -0500	[thread overview]
Message-ID: <463fa1f6-4ee6-ef4d-431c-3c392c827792@lca.pw> (raw)
In-Reply-To: <20190111231652.GN6310@bombadil.infradead.org>



On 1/11/19 6:16 PM, Matthew Wilcox wrote:
> 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()?
> 

If only I knew how to reproduce this myself, I might be able to figure out how
it ends up with the red root in the first place.

  reply	other threads:[~2019-01-12  0:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <YrcPMrGmYbPe_xgNEV6Q0jqc5XuPYmL2AFSyeNmg1gW531bgZnBGfEUK5_ktqDBaNW37b-NP2VXvlliM7_PsBRhSfB649MaW1Ne7zT9lHc=@protonmail.ch>
2019-01-11 16:51 ` [PATCH] " Qian Cai
2019-01-11 17:17   ` Joey Pabalinas
2019-01-11 17:31   ` Matthew Wilcox
2019-01-11 17:53     ` Joey Pabalinas
2019-01-11 18:12     ` Qian Cai
2019-01-11 18:12       ` Qian Cai
2019-01-11 18:16       ` Matthew Wilcox
2019-01-11 18:16         ` Matthew Wilcox
2019-01-11 20:58         ` [PATCH v2] " Qian Cai
2019-01-11 23:16           ` Matthew Wilcox
2019-01-12  0:18             ` Qian Cai [this message]
2019-01-12  0:39               ` Esme
2019-01-11 23:47           ` David Lechner
2019-01-12  2:58             ` Michel Lespinasse
2019-01-12  2:58               ` Michel Lespinasse
2019-01-14  2:20               ` David Lechner
2019-01-14  2:33                 ` Qian Cai
2019-01-14  3:07                   ` Esme
2019-01-14  3:52                     ` Douglas Gilbert
2019-01-14  3:59                       ` Esme
2019-01-14  4:52                         ` Douglas Gilbert
2019-01-14  6:23                           ` Esme
2019-01-14 15:45                             ` Qian Cai
2019-01-14 15:51                               ` Esme
2019-01-14 17:58                                 ` Qian Cai
2019-01-14 18:26                                   ` Douglas Gilbert
2019-01-15  5:31                             ` Qian Cai
2019-01-16 14:37                               ` Esme
2019-01-18 17:10                                 ` Qian Cai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463fa1f6-4ee6-ef4d-431c-3c392c827792@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --cc=dgilbert@interlog.com \
    --cc=esploit@protonmail.ch \
    --cc=jejb@linux.ibm.com \
    --cc=joeypabalinas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=martin.petersen@oracle.com \
    --cc=walken@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox