Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3261412ybg; Mon, 28 Oct 2019 09:58:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwU+oTsTsMB6Bi5P4bU7S1D+y/Ea81nAU/pLGT6yTkh9bAL8AvCwk5SGhohBw2Tu05C5S8 X-Received: by 2002:a50:e40c:: with SMTP id d12mr20296091edm.256.1572281917936; Mon, 28 Oct 2019 09:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572281917; cv=none; d=google.com; s=arc-20160816; b=Wud/sHqLaAN+IjFuEV7+OqYJCWFsQkiLYVEkxRN+XR4ooH5GKdrJ6kEMO3aHHXSXCR NA9oF0uw6B4rADJPQaa/XvRk2GjHKl1crYy32on4m8dmVO4hGRH6aiFmOX1DBWpATw45 swBGt6y/aExD+M7hdnzJ/5ZDZPh4vS5V9G0HoFD7j4unlCu453OiEg3YvM0sU4jiVKzW vTWbMhSiQMvzA2N8th55N2ImiMVk+bP2Bbt4Y00ru/xFvlaa5CSboFrskJO7djAl3bm5 2VaYtz8OvxP/pBMSuBB4bFtOBEp5uegDvHIpB/x91JlAXWno65CoWLD51Ho76yP388OU /DJw== 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:reply-to:message-id :subject:cc:to:from:date; bh=VAkKN8qVCKa8i9rzKGZ28OkjrdgnYBQmv4rCuIszbno=; b=qFNgbBaCiex7nFgpRFISNmug6CfYxPJAOrU/Qh2ufGKcbMkmY8R7iyBukb3fOJsRFh 27A6R/vz7O1XVOshhUaisY7DW8wYT/+MHzd1y6aRcO+oNSMfJ9obSWoFLTyALx9j22Jo VvoWbsf2iQanCDrI8VW2IMP3Hdwx5JijT5k352RqSGnqisa+ZFYdNXv/Olw/PjDSGZNG tzrQRCgpvmW/4O0ygAFo46YxnRVIOiV7AdNeQgk7InOq8Xw0rfcJFZpMyuFbSG1YLGrI nGPpva8ahIoheoKGJ2Q037aOgNjPmLbd0+8zclnP6Z28kYAa3qWiD2K2qQh5eumTaycC OMWw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si3791363ejb.262.2019.10.28.09.58.14; Mon, 28 Oct 2019 09:58:37 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730411AbfJ1GYN (ORCPT + 99 others); Mon, 28 Oct 2019 02:24:13 -0400 Received: from mga05.intel.com ([192.55.52.43]:39005 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728348AbfJ1GYN (ORCPT ); Mon, 28 Oct 2019 02:24:13 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2019 23:24:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,239,1569308400"; d="scan'208";a="198554077" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga007.fm.intel.com with ESMTP; 27 Oct 2019 23:24:12 -0700 Date: Mon, 28 Oct 2019 14:23:58 +0800 From: Wei Yang To: Michel Lespinasse Cc: Wei Yang , Andrew Morton , Peter Zijlstra , Davidlohr Bueso , Thomas Gleixner , LKML Subject: Re: [Patch v2 1/2] lib/rbtree: set successor's parent unconditionally Message-ID: <20191028062358.GA13412@richard> Reply-To: Wei Yang References: <20191028021442.5450-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 27, 2019 at 09:29:43PM -0700, Michel Lespinasse wrote: >Code looks fine, for both commits in this series. Please make sure to >double check that lib/rbtree_test does not show any performance >regressions, but assuming they don't, looks great ! > Thanks :-) >Reviewed-By: Michel Lespinasse > >On Sun, Oct 27, 2019 at 7:15 PM Wei Yang wrote: >> >> Both in Case 2 and 3, we exchange n and s. This mean no matter whether >> child2 is NULL or not, successor's parent should be assigned to node's. >> >> This patch takes this step out to make it explicit and reduce the >> ambiguity. >> >> Besides, this step reduces some symbol size like rb_erase(). >> >> KERN_CONFIG upstream patched >> OPT_FOR_PERF 877 870 >> OPT_FOR_SIZE 635 621 >> >> Signed-off-by: Wei Yang >> --- >> include/linux/rbtree_augmented.h | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h >> index fdd421b8d9ae..99c42e1a74b8 100644 >> --- a/include/linux/rbtree_augmented.h >> +++ b/include/linux/rbtree_augmented.h >> @@ -283,14 +283,13 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root, >> __rb_change_child(node, successor, tmp, root); >> >> if (child2) { >> - successor->__rb_parent_color = pc; >> rb_set_parent_color(child2, parent, RB_BLACK); >> rebalance = NULL; >> } else { >> unsigned long pc2 = successor->__rb_parent_color; >> - successor->__rb_parent_color = pc; >> rebalance = __rb_is_black(pc2) ? parent : NULL; >> } >> + successor->__rb_parent_color = pc; >> tmp = successor; >> } >> >> -- >> 2.17.1 >> > > >-- >Michel "Walken" Lespinasse >A program is never fully debugged until the last user dies. -- Wei Yang Help you, Help me