Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3533268ybd; Fri, 28 Jun 2019 10:14:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0rW3hI6aYjH4VJV85SmJESt6xkIIATxYsPMBERathPkJJ/1asctUSXm3FEy93nEGaVCfy X-Received: by 2002:a17:90a:216f:: with SMTP id a102mr14713037pje.29.1561742095102; Fri, 28 Jun 2019 10:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561742095; cv=none; d=google.com; s=arc-20160816; b=EPPU95mKICiPkOFOQ/TcmV/GkP1BgNI1+Izl56Wiyr+6H+C0q/x+CMykSH4l40LsCO ktSXdFkhNy41J/a0KzTW6u7katEqnfje2gOp+844+OuqUMPVqpcUPdfjFp2c4Gjc7Zw4 jCWGv77elchRZzOXvT1Wmg1ZFaJ75gIj3glmY20FbQW3WrGE5tqQgqT0lKs48N0PMJyP z5HoONudaJRWmY+Ht4gkp2hgSMGebNCAR5MKG9j8pQd9/afu4LoyC+VwnfLHSkKndQkx 3ePkECSSaVU5EIfvlTwTMAz8nfUgZb5mPx+m91MyuivRn8i5lGoWYEKsNpcaGmjftqmO QjQQ== 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; bh=CCrcIXuU0IAKtjiki+CD29RH0+EObDoihLfW8hXDa9w=; b=LfbV7fW1YDs50toJdFqadYFqnYQoEow9MiKR7WHLpMhUYE9Aj8Xz8TDE8BUyuIj5EQ E1cR/thUipsWkvAwx1wKepX41n4U511+nK2ZWJgjyEJw469wwBo1XFzWmxhsO85wBL2i y15fF/DgAF60JHoHSYZJzee+P35KxQxhgcs0nwYglx/vBTKd+uj/G1EM13tOobk6E0gh rNCj+qjRVj33Yf33WcSvZn6gz0NN/L5O/8pJMxICJs3qDIWJhwG3ZgahdyJzicSIsVHz 2kCDPjrybiBct8hEdwWyGkbzuvgZde4J8QfWjloq/RiiLvK029XqLFgNav421tDC9PnO czIw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h194si3034121pfe.214.2019.06.28.10.14.37; Fri, 28 Jun 2019 10:14:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726672AbfF1ROW (ORCPT + 99 others); Fri, 28 Jun 2019 13:14:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:56446 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725783AbfF1ROW (ORCPT ); Fri, 28 Jun 2019 13:14:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 38FEDAD94; Fri, 28 Jun 2019 17:14:21 +0000 (UTC) Date: Fri, 28 Jun 2019 10:14:16 -0700 From: Davidlohr Bueso To: Michel Lespinasse Cc: Peter Zijlstra , David Howells , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] rbtree: avoid generating code twice for the cached versions Message-ID: <20190628171416.by5gdizl3rcxk5h5@linux-r8p5> References: <20190628045008.39926-1-walken@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190628045008.39926-1-walken@google.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Jun 2019, 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. Also: text data bss dec hex filename 5405 120 0 5525 1595 lib/rbtree.o-vanilla 3827 96 0 3923 f53 lib/rbtree.o-patch