From patchwork Fri Oct 27 03:38:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13438099 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 0E2D6C25B47 for ; Fri, 27 Oct 2023 03:39:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 956876B0390; Thu, 26 Oct 2023 23:39:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 906F16B0392; Thu, 26 Oct 2023 23:39:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D9096B0393; Thu, 26 Oct 2023 23:39:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6CAA36B0390 for ; Thu, 26 Oct 2023 23:39:48 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 49C23160F46 for ; Fri, 27 Oct 2023 03:39:48 +0000 (UTC) X-FDA: 81389837256.05.25E57F1 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf28.hostedemail.com (Postfix) with ESMTP id 7A456C0013 for ; Fri, 27 Oct 2023 03:39:46 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Of0bswXg; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698377986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=74qqxidjqyd9XulDVkugPZl+GB+TldL/DBrAezqtgJY=; b=yiQcMLUgMt674Wdon42r2QFsUklgEM7RPW00RoadjnSA1LLt3c/Iyawm8pR3HcjOKPyvZr AufImFVKam1hH+w0tF6le3SIbTqskmS9f7bV56EZWfdd/56zWwbDo1srThQLRi/u1ERw/1 IdtTv5RU+aOERwnlUC0OStgpj+kreAU= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Of0bswXg; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698377986; a=rsa-sha256; cv=none; b=P54SAg3ndUCFAU4/QZhTBopVmrzVzt20gNnbwrp0p0N+92+uKhhsN926bYmt4x0SJM/ZOu jT9MPd4fh+m+dB33ApAq9JrsJQwPwXQSDE0ndgWp5UMdblp+O/Sk0otcIEokWG/2ToCFHK waZKaWdOiCCTc0neapMjijn1sDybY+M= Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5b9390d6bd3so578679a12.0 for ; Thu, 26 Oct 2023 20:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698377985; x=1698982785; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=74qqxidjqyd9XulDVkugPZl+GB+TldL/DBrAezqtgJY=; b=Of0bswXgBHDRPu7+yMA4IhFURUxANsdogVjX0LM7xw3jKjnZom89EzzmC80oAURtBm frUhax2o6XU12ktjtC+R4ICWaxI/l9fki0aQYmb4ow0inXN0usmz4DfYw5B7GP9CbJaw BbgygLFnaJV4Zz9Ook3NudfELiqZPPe6Ut7tXlz8pSn9Cf+E/KL9jHG0bTG32vawhXEe GTbuF+xnqxuMBydIaEM6jDOsc8FUXNqg+0MGVmGVtRnAU9VbVEM7VNctN6VR4M+whlRp fyk+gBRxtuC9DFY680j2GEPbaIExqWtQQP6vx3QtK6uaoU2WtGehBJTbwa45Jia66znP hNmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698377985; x=1698982785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=74qqxidjqyd9XulDVkugPZl+GB+TldL/DBrAezqtgJY=; b=O9FHRCRdITbFr3bwY/regy5tKvhrVvmLG1IeuV9dWNlfl215n5r8fwCTQwFighkyzq teVZIQtywOK+ZUCx2a+NaC4bXQG98CmzqcjNQchvx/rUOvhkLGpNo1D/1acBUzW+SHiM pg7eowQxGG3GdlK70HO6HodH3OB5JSJoTNcgcv2zYCsm6qDHuIIUwvGx77uc7XGFp9E5 rUhA+1UAnYaxrpa/8Z/QuZiZbPqsUXEa9ndCEt/BGxSqR6ymmZOeyrHJd7Ez3/XkGeBk /srRiLUgMpTXffkstlbg12vBNj2xZGg2jd9a7vSL5yPrzOyvIVPl8F2Qs9xyazwQ8MiX dOxg== X-Gm-Message-State: AOJu0YwFaFhaMzWDni03KeABk29zjZALs6Wo8nW5rv2By/UcrJAM1cKC Rw0JLFWlpHuXQlU0lS0gLXYdfA== X-Google-Smtp-Source: AGHT+IE0WBlgixccb7xQyscB6ftmdLDZ7xdSH5V+CyxdwveadRU+NlM0bptvnd1oQV9FJPaGCIUEEQ== X-Received: by 2002:a17:90a:9708:b0:268:808:8e82 with SMTP id x8-20020a17090a970800b0026808088e82mr1969715pjo.1.1698377985415; Thu, 26 Oct 2023 20:39:45 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([203.208.189.7]) by smtp.gmail.com with ESMTPSA id ms19-20020a17090b235300b00267d9f4d340sm2345676pjb.44.2023.10.26.20.39.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 26 Oct 2023 20:39:45 -0700 (PDT) From: Peng Zhang To: Liam.Howlett@oracle.com, corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com, mst@redhat.com Cc: zhangpeng.00@bytedance.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v7 06/10] maple_tree: Update the documentation of maple tree Date: Fri, 27 Oct 2023 11:38:41 +0800 Message-Id: <20231027033845.90608-7-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20231027033845.90608-1-zhangpeng.00@bytedance.com> References: <20231027033845.90608-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 4ufj15axbwj88nww3mpg19ihux1n7wgq X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7A456C0013 X-HE-Tag: 1698377986-595762 X-HE-Meta: U2FsdGVkX1/WY0atIFzEcTrpKfQV7DSrYryLvY3PGNhKjeD9+h5w3ffsHR2r7bsy2r5Y9/sYk7YBKfV+CclYIhQ4+eG/J5jxjxL/auLIgEBZPUZugmVW4nd0/N8kP3Ij+UZsY5Grv2c2YljvQKvF/ViGWtCM+OtNghNasHBCOsR4G5pNZrGcoirRHnhMkO5ZMbqlx6kqrEk8uUP98mS2YDAtLKAk23LlxVWdMeIFIsoxUzPlV+LJ4j+Pq6w3hASu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pYtvEocp9aNY3ywGlTMLhZGNVNiUPXkaFdGJVIummaisIKQdacl87Q2q3ZA5BzTI7MhlXs8fUinIZPoEpLqD3K5OtVAsvHV40I1fO7xHqUDjYpiVxuAwbUFMjEaRPaKInohv0Uu80nqSMthjECcojIb/O0HL8wI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Introduce the new interface mtree_dup() in the documentation. Signed-off-by: Peng Zhang Reviewed-by: Liam R. Howlett --- Documentation/core-api/maple_tree.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/core-api/maple_tree.rst b/Documentation/core-api/maple_tree.rst index 96f3d5f076b5..ccdd1615cf97 100644 --- a/Documentation/core-api/maple_tree.rst +++ b/Documentation/core-api/maple_tree.rst @@ -81,6 +81,9 @@ section. Sometimes it is necessary to ensure the next call to store to a maple tree does not allocate memory, please see :ref:`maple-tree-advanced-api` for this use case. +You can use mtree_dup() to duplicate an entire maple tree. It is a more +efficient way than inserting all elements one by one into a new tree. + Finally, you can remove all entries from a maple tree by calling mtree_destroy(). If the maple tree entries are pointers, you may wish to free the entries first. @@ -112,6 +115,7 @@ Takes ma_lock internally: * mtree_insert() * mtree_insert_range() * mtree_erase() + * mtree_dup() * mtree_destroy() * mt_set_in_rcu() * mt_clear_in_rcu()