From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CBF0C433EF for ; Thu, 3 Feb 2022 08:57:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C3188D0133; Thu, 3 Feb 2022 03:57:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 672C18D0129; Thu, 3 Feb 2022 03:57:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53D6D8D0133; Thu, 3 Feb 2022 03:57:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id 439F48D0129 for ; Thu, 3 Feb 2022 03:57:54 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 03CB11828496E for ; Thu, 3 Feb 2022 08:57:53 +0000 (UTC) X-FDA: 79100866068.19.0F433B9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 901C840002 for ; Thu, 3 Feb 2022 08:57:53 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF12260AF4; Thu, 3 Feb 2022 08:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07CD7C340E4; Thu, 3 Feb 2022 08:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643878672; bh=0O4UQoD2ga6k8Fj8aX29klaeBEumEjofWg7hsdFfsM0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kHAcnm6m+d9hh1HYDeWKJxuqlTL8N0UTPGjjxyOHFvOw+as96nNEr1IDN498AE04m KH8rBQarAamNG3Nj23bJHWgBfem4/xVw+2NmVxDO6ypA0MAARNJ6EmueTXmCeoJZ9x VLUheQVh6myRN6SVBhCxcqsST0ZVryAQUqN+hsC++XqsZlAky6D7ISbYTiUObqmTjx 5wjDXMe7QQSLJyE6aYko1KPFxdK5yAw9ixt7BhhIkMf1i9mvC8K8AQx51OIqlsvPct 4JvJvP7EqRV1GJiECRvfIEOXfnUK6wYguOEdBPMhqswBX2FZkZNeQN6/zTCR6NnX+g ZY9S0u0501uZQ== Date: Thu, 3 Feb 2022 10:57:43 +0200 From: Mike Rapoport To: Liam Howlett Cc: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: Re: [PATCH v5 07/70] Maple Tree: Add new data structure Message-ID: References: <20220202024137.2516438-1-Liam.Howlett@oracle.com> <20220202024137.2516438-8-Liam.Howlett@oracle.com> <20220203023836.bfu2mviijlkc2pgz@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220203023836.bfu2mviijlkc2pgz@revolver> Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kHAcnm6m; spf=pass (imf17.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: nil X-Rspamd-Queue-Id: 901C840002 X-Stat-Signature: aqs3tdgpor4cewgfrnxpzfz9co7wgszj X-Rspamd-Server: rspam12 X-HE-Tag: 1643878673-141718 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 03, 2022 at 02:38:42AM +0000, Liam Howlett wrote: > * Mike Rapoport [220202 12:11]: > > Hi Liam, > > > > On Wed, Feb 02, 2022 at 02:41:56AM +0000, Liam Howlett wrote: > > > From: "Liam R. Howlett" > > > > > > +The Maple Tree maintains a small memory footprint and was designed to use > > > +modern processor cache efficiently. The most important user of the Maple Tree > > > +is the virtual memory area. > > > > For me it sounds like VMA *is* the maple tree user. Maybe > > > > The most important usage of the Maple Tree is tracking of the virtual > > memory areas. > > > > Thanks, I can see that now. I'm not a fan of either of the ways this is > written but yours is more clear. Maybe you can come up with even better one :) > > > diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h > > > new file mode 100644 > > > index 000000000000..14ddeaa8f3e7 > > > --- /dev/null > > > +++ b/include/linux/maple_tree.h > > > @@ -0,0 +1,673 @@ > > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > > +#ifndef _LINUX_MAPLE_TREE_H > > > +#define _LINUX_MAPLE_TREE_H > > > +/* > > > + * Maple Tree - An RCU-safe adaptive tree for storing ranges > > > + * Copyright (c) 2018 Oracle > > > > 2018 - 2022? > > Wait, what happened in 2019-2022? Did I miss anything? I'm really not a copyright expert, but from what I see the dates in copyright notice use the year when the patches are posted or a range that end in that year. > > > > > + * Authors: Liam R. Howlett > > > + * Matthew Wilcox > > > + */ > > > + > > > +#include > > > +#include > > > +#include > > > +/* #define CONFIG_MAPLE_RCU_DISABLED */ > > > +/* #define CONFIG_DEBUG_MAPLE_TREE_VERBOSE */ > > > + > > > +/* > > > + * Allocated nodes are mutable until they have been inserted into the tree, > > > + * at which time they cannot change their type until they have been removed > > > + * from the tree and an RCU grace period has passed. > > > + * > > > + * Removed nodes have their ->parent set to point to themselves. RCU readers > > > + * check ->parent before relying on the value that they loaded from the > > > + * slots array. This lets us reuse the slots array for the RCU head. > > > + * > > > + * Nodes in the tree point to their parent unless bit 0 is set. > > > > There are a lots of comments describing the maple tree internals here and > > below. Did yaou consider adding a section "Implementation details" or > > something like that to the maple_tree.rst and linking these comments there > > with DOC: and some glue text? > > I did. I actually had it in there but moved it into the code in an > effort to avoid the documentation from being a developer doc. I'd like > it to be a user document. I also did not want the implementation > details to be too far away from the code to avoid it being missed when > the code changes. There could be two documents: one for the users and another one with implementation details ;-) The implementation description can then include DOC: parts to keep that documentation close to the code. But if you prefer to skip this part (like most of us do) I'll understand :) > > > +/* > > > + * More complicated stores can cause two nodes to become one or tree and > > > > ^ three? > > Yes, perhaps I typed my accent here :) Or because it's all about trees :) -- Sincerely yours, Mike.