Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1824651ybi; Mon, 1 Jul 2019 00:52:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUOCGxvY/6+ND0P0/fP6qhABAbG2GB3lKCcwfppvHkLylbk0vzLzp01NSjUmmAo1X3A6lq X-Received: by 2002:a17:902:44a4:: with SMTP id l33mr27415774pld.174.1561967534092; Mon, 01 Jul 2019 00:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561967534; cv=none; d=google.com; s=arc-20160816; b=GaIw/dctwEJmSBdMz3R7ygS2SpAx7mFKlr10ofY9zB6Glb0+hKRfeBgm0d4Z3Sa2C5 ERQ1JgVmE9Xj/p0m5uAYb0iFUa1AMzKTpuc8iXjiuP9QVcErtxpbGjOIE9NFyFFu4Y0t iYAsyfNkWJyrh1j240xAEdKi8o7iiFpUtSFVFpP3355nkqtN9P37DzV2G4sBBe64+UcM Di6EmXpikFDAsbcaY73UTmBY6NOohQadlo1uW8s1AtOeBDo25vP17WjmauDaxb2OCfY4 WXe19Dazvi47iwbGqOD5JVlKENMTo0pOxeQMTODi2IiEQMTV9uYV73x2Vwaomnlh9GYR DxYQ== 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=dRqxafrMZIpojDELdzomwmakTdubds+IayDLNdEzxbI=; b=xN64HFQBUtI+CYKltAje+SpQ0Kuf1vZrB8jDXWCa38S0APKJnJXGHTgHklN8vCvIET xs2RWLMxxQW/q7B6SSDKYhFotjz9hOw7Vh3g2MI36O8Y1DJxPeOH5fbVH02sBF2ZFCPZ 0Q+Kg1CVq1xi0HqiaV+ixRwVM1XbDfpgFy4XGMmU89HFLRxtujHLAX+e0r/FV/PeF3Rj neXPQdi4kaeve2OPp33jR50wH1WZyt1+4pHKXSMyFRK6KZ2hR9A4CVMYoXEBaQZn4wAc Un4Pmjv39tfKB1bI+5GKOCLn1/zaYT/0eWPtCGDkf4wwry2kxwiU3pkBZNmdRs6dtdTE C18Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pgx5v8Yk; 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 k5si9907085pgm.297.2019.07.01.00.51.58; Mon, 01 Jul 2019 00:52:14 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pgx5v8Yk; 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 S1727861AbfGAH0y (ORCPT + 99 others); Mon, 1 Jul 2019 03:26:54 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48362 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727224AbfGAH0y (ORCPT ); Mon, 1 Jul 2019 03:26:54 -0400 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=dRqxafrMZIpojDELdzomwmakTdubds+IayDLNdEzxbI=; b=pgx5v8YkxCQJYmzC+hmmpOEiN 6Ucd0F/aWF+8d8UX7CO/j4BCxdiC7CuFIFEPRxzl+ngptOU7ysG+jBLVfzr+p2LtEdNKZcGYxRUfz r96/vox6bUQoipY84jwzEDzLmZjHUNBRrbbLK9aWRz2vdmggcXsLPtbgSukHM5HLMcFGsoucB6N4c 8aIxIGtw6KcLYWGWznvGqQxZ68zq0fVj7FCScWC/QeEPnZJwqMv3dw4ccTSzMNNOB9TCEpitdi/fQ snbr6bbnHhX0eUEO4hBAcvM8csO9q0KSK7tUSox8Q8mhyvQnhNkqhZEq0rn2egIw56iqvEWcl1OtB u37YM1Hng==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hhqi7-0007PU-J7; Mon, 01 Jul 2019 07:26:47 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F2D8E20A87D66; Mon, 1 Jul 2019 09:26:45 +0200 (CEST) Date: Mon, 1 Jul 2019 09:26:45 +0200 From: Peter Zijlstra To: Michel Lespinasse Cc: Davidlohr Bueso , David Howells , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] rbtree: avoid generating code twice for the cached versions Message-ID: <20190701072645.GK3402@hirez.programming.kicks-ass.net> References: <20190628045008.39926-1-walken@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190628045008.39926-1-walken@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 27, 2019 at 09:50:08PM -0700, Michel Lespinasse wrote: > As was already noted in rbtree.h, the logic to cache rb_first (or rb_last) > can easily be implemented externally to the core rbtree api. > > Change the implementation to do just that. Previously the update of > rb_leftmost was wired deeper into the implemntation, but there were > some disadvantages to that - mostly, lib/rbtree.c had separate > instantiations for rb_insert_color() vs rb_insert_color_cached(), as well > as rb_erase() vs rb_erase_cached(), which were doing exactly the same > thing save for the rb_leftmost update at the start of either function. > > Signed-off-by: Michel Lespinasse > --- > include/linux/rbtree.h | 70 +++++++++++++++++++++----------- > include/linux/rbtree_augmented.h | 27 +++++------- > lib/rbtree.c | 40 ++---------------- > 3 files changed, 59 insertions(+), 78 deletions(-) Acked-by: Peter Zijlstra (Intel)