Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3199081ybv; Sun, 9 Feb 2020 17:47:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxcud39HBvgsKIvTEC55rtvzkcI/PTDwbz3s3fNd4X5NviLHWhRajbDBrhDUhmQyMsV4+wD X-Received: by 2002:aca:53c6:: with SMTP id h189mr9370804oib.11.1581299272815; Sun, 09 Feb 2020 17:47:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581299272; cv=none; d=google.com; s=arc-20160816; b=GwZcVUeIAufRUUPaNIyCE/q+/EzkeMXI0Nw36GP2UJH2KUeFU5Llro2RoweAx1iROP CAgjOLmuL6DR72yKJ55Lg5wvy34D0dPzngS8WRJcBuLkE4yC+vcqcsiL3rD/88VRHseM fWN1pA13A6tKjPdM3HEFG6MnbWaGGy5WRCmIyc1JnYcIaD9VBZVPdvVxPHjvR+EX7Q4M 5TDlpLmcBBHxVwcClguMjMLI+liTotlfoX40VMNX2Yv82/CkV7Dqbw/EmZMn+VCteeGD co9n263Kimn2YAa7IB5NNWhPizmwXCkGjlFh0hWEb7+leYZJPR/eSJgdowYHn5lbNoND 58RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=z4d1ZURpTGKqfHbP5NwxxEt2ElNaYymhbn4g4X4b2us=; b=fjxsQ0Np2yUq7Vk+NLotomv8hYgJrotPmGr1GZnQg/hvbGKE+X9RV4vV9mACsLLDh8 kOxF80VD3QLTJpdiMEJuFfQfpKMxK1dM0eygYSLffKT32Z8QY9dZ8RqjoIpZfqUqNz6Q T8Ro/1SqG1X/aKiWy+mi7GUmQ5PQ7EGbb3tRmwSH6PBHZhb8jm0/v2hYU1+MpjJS7SyR 1fCoUfwUfmTw6T8CF9p1ExXsWdst6P0ujbYYRPFsshijV/BvyFbVYB5fEz5WN35xLPVs oI12TtE6KwyR4KaY0yvSiOSwWLekz/UGeFk0OZtfgb4e2d9M323k4EP8qJUw38tngu6B 8LgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v+ShQy1i; 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 s129si7703194oig.177.2020.02.09.17.47.40; Sun, 09 Feb 2020 17:47:52 -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=pass header.i=@kernel.org header.s=default header.b=v+ShQy1i; 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 S1726915AbgBJBqe (ORCPT + 99 others); Sun, 9 Feb 2020 20:46:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:37702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgBJBqe (ORCPT ); Sun, 9 Feb 2020 20:46:34 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49DFF20838; Mon, 10 Feb 2020 01:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581299193; bh=Y/a7kDN56rMD+1WLqPqN+7Z3YFOjfEIzGOm3VH3cENo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=v+ShQy1ieLFZnd8zebV6Xon3bdfr/CVqiQZzCB5BXvSonplc3K/uLYRtgBDtFtxF6 0VKo1ML0U6fJgHfrZ/NgPICWwcBfss3d4xpxoVcrd5U9wLvG97GIDPWibJHgtF9tQH /DWBWWN1daYWERPmEGYwGMck3h8zd9Mqfjz3imyU= Date: Sun, 9 Feb 2020 17:46:32 -0800 From: Andrew Morton To: Davidlohr Bueso Cc: linux-kernel@vger.kernel.org, mcgrof@kernel.org, broonie@kernel.org, alex.williamson@redhat.com Subject: Re: [PATCH -next 0/5] rbtree: optimize frequent tree walks Message-Id: <20200209174632.9c7b6ff20567853c05e5ee58@linux-foundation.org> In-Reply-To: <20200207180305.11092-1-dave@stgolabs.net> References: <20200207180305.11092-1-dave@stgolabs.net> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 7 Feb 2020 10:03:00 -0800 Davidlohr Bueso wrote: > This series introduces the ll_rbtree interface to optimize rbtree users > that incur in frequent in-order tree iterations (even full traversals). > This can be seen as an abstraction to what is already done for dealing > with VMAs (albeit non-augmented trees). > > Mainly, it trades off higher per-node memory footprint (two extra pointers) > for minimal runtime overhead to gain O(1) brachless next and prev node > pointers. See patch 1 for full details, but, for example, the following > tables show the benefits vs the costs of using this new interface. > > +--------+--------------+-----------+ > | #nodes | plain rbtree | ll-rbtree | > +--------+--------------+-----------+ > | 10 | 138 | 24 | > | 100 | 7,200 | 425 | > | 1000 | 17,000 | 8,000 | > | 10000 | 501,090 | 222,500 | > +--------+--------------+-----------+ > > While there are other node representations that optimize getting such pointers > without bloating the nodes as much, such as keeping a parent pointer or threaded > trees where the nil prev/next pointers are recycled; both incurring in higher > runtime penalization for common modification operations as well as any rotations. > The overhead of tree modifications can be seen in the following table, comparing > cycles to insert+delete: > > +--------+--------------+------------------+-----------+ > | #nodes | plain rbtree | augmented rbtree | ll-rbtree | > +--------+--------------+------------------+-----------+ > | 10 | 530 | 840 | 600 | > | 100 | 7,100 | 14,200 | 7,800 | > | 1000 | 265,000 | 370,000 | 205,200 | > | 10000 | 4,400,000 | 5,500,000 | 4,200,000 | > +--------+--------------+------------------+-----------+ > > > Patch 1 introduces the ll_rbtree machinery. > > Patches 2-5 convert users that might benefit from the new interface. > > Full details and justifications for the conversion are in each > individual patch. > > I am Cc'ing some of the maintainers of the users I have converted to the whole > series such that it can the numbers and interface details can be easily seen. > > Please consider for v5.7. Seems that all the caller sites you've converted use a fairly small number of rbnodes, so the additional storage shouldn't be a big problem. Are there any other sites you're eyeing? If so, do you expect any of those will use a significant amount of memory for the nodes? And... are these patches really worth merging? Complexity is added, but what end-user benefit can we expect?