Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1104387imu; Fri, 11 Jan 2019 15:18:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN5hV7dPLjAZWu2XdJ7JdeFtpzWvf7wwQIQxsgsaMgv7GSyw4pcadDQHKK0F4sCLZYbKsizW X-Received: by 2002:a17:902:d891:: with SMTP id b17mr16798492plz.80.1547248703802; Fri, 11 Jan 2019 15:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547248703; cv=none; d=google.com; s=arc-20160816; b=oq02Ky0Y34M+LUtifHFGUfFqdb/Xj/Icxkq8dSNRTedqe/qtbqH1YPetcG9WtWn+FW 3sMQAggLvxLzuvlUzm2QPo6yLlIavP+nJ1HyVGTbUDEI8pV1SKmbblTwJbz6Zt0WYlS5 k0jawdGNV70UF0EBtxsyrB/mA96nsWs2x7QMheVVUIWrYpfWNSK8QO/408PMGRArXl+0 tMoQ8jjZLP2BRSXP/IaUXv700BhHQyG6PDiNL0afFym//sgHMknb3YvRPxcbghpbs5+P +xH+Y/zzx9P+AEU4TSlO/VQUrESrTMT8wKJIQF+WxqiqDgHFioCbluh+ka+jbzKxKfgU O+eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CqUrK5dNQEzXqROC1W6wTAlH6VB8x27DzSSJz0NWLaA=; b=IrUM/NRvTMfJ62y8Hp8CJUpOZHXzwFSKkUKqRr5M9oH5iv8Ugf6gUdcKtmd42AY4JH yHFPdVtcYwX1jkMtzTsi/Q9bjMv2FsJQUU5cN3IP/qq7d3fbFhKv16sy1xe7lOiql4nh uwtz0dy/H5SP58XHWHZEVHuNaOTOlOq/6ol/Mbe31IGhNjSWZLPKTISTouPG593Lza9R aT63UDheL0+waVfvECMNePFxScUSXIcMSkRhDlhFPN8qhvRIcjuqjRXLEU9udhF/B/so qeJqFL8QRPsMV/p7Dl89GOeYOVOpwjZMtQ2kE3phcFIDmShc66POVSlI7StqXadaWGaS gohA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=PNKxCRqE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z31si23416187plb.402.2019.01.11.15.18.07; Fri, 11 Jan 2019 15:18:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=PNKxCRqE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfAKXRC (ORCPT + 99 others); Fri, 11 Jan 2019 18:17:02 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:36426 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbfAKXRC (ORCPT ); Fri, 11 Jan 2019 18:17:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CqUrK5dNQEzXqROC1W6wTAlH6VB8x27DzSSJz0NWLaA=; b=PNKxCRqE8uKre6yZ5mT4/I1c1 bvKOeLTqnmOUbxaqEWvawGxK3QjgzVohm/VDasY1WtbMMgLj3/Nvd6lSlAymxjGrEIalUj6zuWea4 fpETwvZWV9x+Dtyj0Ke8EOjKofcI3Z8BeJxiNSexYAZ36xpVw8glRbxLm4N1zlfmSP0cVDARTb0jz aHVp3rV0GbRSXLBULKV0xXJWAb5cDfKYODa/eVJRYZd+PcR7F0QrlXgiWbdliZx8qUthYIBXLArB6 yqlB6yIRZZwiXZawAe8Yj99xfqn0xnu+tN6go4xBdxBZZs12NfsXPdATPOIb4jg2HHnxk/RzsY2WV TziJUY5dA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gi62m-000375-Cm; Fri, 11 Jan 2019 23:16:52 +0000 Date: Fri, 11 Jan 2019 15:16:52 -0800 From: Matthew Wilcox To: Qian Cai 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 Message-ID: <20190111231652.GN6310@bombadil.infradead.org> References: <20190111181600.GJ6310@bombadil.infradead.org> <20190111205843.25761-1-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190111205843.25761-1-cai@lca.pw> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()?