Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3736673pxb; Tue, 26 Jan 2021 03:31:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJAU39p+zmEjtGZvzqgrJFqQkFsDyn8NxGuEe3E5ehpesWWCXnYkAQpog0m+0f9AhpU/G8 X-Received: by 2002:a05:6402:143d:: with SMTP id c29mr4247100edx.274.1611660667386; Tue, 26 Jan 2021 03:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611660667; cv=none; d=google.com; s=arc-20160816; b=a2sBQpORkQOcx+/4S2TdnaO/2IC1j/Y0SAZcIxO0XIWzJcFa/0o3aNe5WZ3vd9Bevq lYiQz98UelNR9OiN4rFoeiLDKmBr1hEa0RkLA8Fp8xdSZA4aKsbzli64CRhKCG8ryuzA KtlzRHdWzEECs2CXa0+hHKZJkbeTcJYFuA6Ys8GnczMi/9jSzzL9g8aMA5p23v+4gPpd Hur1l56hi6Ju2Cjb9lgD+OFwJbSrdCn8QV8GF1/oy+s3mYhA6AlCfy/9lW7yOR6bYQ7s 1aQ/euSB9AqWZq/ftexRK1gdAcoKBIWkso+grEdoc50RQiTzH9I0i1m0EXJQ7X7UUinB UxYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LDC30rpEcAbHdhutlQsUsirJW7ovALxs1FGVVx0GKr4=; b=d7LUoWtu+wN8tOrmdk+2DHOOSGz0NoLwmpJ6vbjYlpMS5zOTQpizwNQ2YrhgwV9Blv 2JAlIk54s8gfksBZmRQkyJ2TOtgn6TKhhOzdI9BGiWyrAyjMCrCDUcv/RgbTQKp/2iUq yqGDzk1U4CpOY6S6qDr6Qta/53n60BCenoYHd+QaJ9wO1DYDd01xrH6z3y83rjWfemob gpLgutdtN/5tJaZ+WMTrk4MIevROxX+IP5PQrPcbhpftVAmRUY81K+HDESno8nhC7/Wh eF8in9VAJ4Yc4udM8zoe22BFU4vKSsjmgKpGkj/T0zXzO6h8yR8V8EsqFgVqwhp4ujPU M4TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rDekEOwX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn22si6842749ejc.74.2021.01.26.03.30.43; Tue, 26 Jan 2021 03:31:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rDekEOwX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404945AbhAZL1e (ORCPT + 99 others); Tue, 26 Jan 2021 06:27:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391224AbhAZJcQ (ORCPT ); Tue, 26 Jan 2021 04:32:16 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC185C061573 for ; Tue, 26 Jan 2021 01:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=LDC30rpEcAbHdhutlQsUsirJW7ovALxs1FGVVx0GKr4=; b=rDekEOwXF9rOvHeIf7jMuNmkux xUU0FwthSBnzWwhDDFd+pG09q3NLObZhAXR78Da/r1Rl+IjtHUtfKRz/e3XraPwAkeW+MKkszWzSL sHD1ZteR/tMJHM+TA2729a3EKCkmRJm6PqvOCsQno/IgiOKeD/CYw7OKhdqrPesbnfNNzZXvkehfn IvEeBZNVldLgFNG5iAI6G//cKmq3v7usjOdVd2vrmBmtY4A8Qs0sw3EKS/8+rV1vduu89qYrp45N6 tw0Aqwv+b4uLwx5mu3TLvx6s6zietI9Np8WeGPOhsPb3pEp1S2pfyL+zB65p8oVWV6yWcvgV+p3Lb LVSYsy1g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l4Kfn-005MfQ-9w; Tue, 26 Jan 2021 09:30:27 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A49CA3059C6; Tue, 26 Jan 2021 10:30:06 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 886CC20297EDB; Tue, 26 Jan 2021 10:30:06 +0100 (CET) Date: Tue, 26 Jan 2021 10:30:06 +0100 From: Peter Zijlstra To: Davidlohr Bueso Cc: linux-kernel@vger.kernel.org, walken@google.com, mingo@kernel.org, tglx@linutronix.de, oleg@redhat.com, irogers@google.com, juri.lelli@redhat.com, vincent.guittot@linaro.org Subject: Re: [PATCH v2 5/7] rbtree, uprobes: Use rbtree helpers Message-ID: References: <20210125150953.679129361@infradead.org> <20210125151314.888570583@infradead.org> <20210126055949.wriil3xj7wx5peed@offworld> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210126055949.wriil3xj7wx5peed@offworld> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 09:59:49PM -0800, Davidlohr Bueso wrote: > On Mon, 25 Jan 2021, Peter Zijlstra wrote: > > > Reduce rbtree boilerplate by using the new helpers. > > This reminds me of: > > https://lore.kernel.org/lkml/20200207180305.11092-6-dave@stgolabs.net/ > > Would a walk optimization (list+rbtree) serve here? Not sure how big > the uprobes_trees gets. Oh, that's patch set is horrible.. You can do a linked list with the unused node pointers directly. https://en.wikipedia.org/wiki/Threaded_binary_tree So instead of using NULL for the empty rb_{left,right} pointers, use pointers with the LSB set to differentiate them from regular leaf pointers. Other than that, threaded rb-trees would be awesome. I've meant to implement them a number of times but never had the time to do the tree-wide clean up of the rb_tree API to enable them.