Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1001110rdh; Sun, 24 Sep 2023 23:15:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuf6nq5x6kmH2a1ZFa7ySTnNkkAO7ZMj3/hjKm7ZoiI4GxeQivH+n+DNtdQQn0Pm6ZpEhn X-Received: by 2002:a05:6358:398f:b0:143:a0bf:9a49 with SMTP id b15-20020a056358398f00b00143a0bf9a49mr6988623rwe.3.1695622545344; Sun, 24 Sep 2023 23:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695622545; cv=none; d=google.com; s=arc-20160816; b=ctm54UoSNhRPox49YHK6AC3WbXGgwuyukj0oHoj2iUe3FzjOQYhxsUuCNFl2U6KkaR YzNUrSfYxmTdxhXcZrlBKevDHwIBX4gh0cQ8iDGGDhT3bl9BVjETM3KFKubu420Oe32D cwBJo8759BqR2VZa6ElrvwNnfVwpc6aM0H43wLTwBXvxM9SsifpZexMfr17tLmtuWCFy ph1DFzUp7nKLexyFTub9kXALyjrBRWZ9jc8T1etH/8tpo6ZuLLpBLTwHjkEG74jUOt+H eNbu6yWJ9tW/wvnnrwJ/biI/zfpnolu7+oGYP5rPPbabkWlCAD3XD9x4TuKOx/Lu9/Sb K9kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hww7oOWxGKb7qmsb0mmM2P/enCFKvkDkB3bMeqs1n3g=; fh=uq6KVc+CzZ80ucpwrp8f3d+Fe7Ue0w5J0Au2lk064nU=; b=nodiPz66jqCzd9tRdL/GN2DrP4W2s0AwSCihgB9IXfnOXWgr0Ek3JeqEIcKZ3LTiww QG+3m7PcENrIabcKMuUjxIWhXbyMwEPfQr5vOKbmyUrYpmDFjxbZaKwU3Xdh+JIylXww +3Vsi0dvf59dPWWJiv5AVBdxhHxH6egfzKyCc205ud3x1jPJ8PwYX4fhSPalhds7PC21 Dv9S3GM0wUBA305zRcknJ2OE27KP3Fj298x0EPJqoQ+3xCDLOxh5AlkudUInG2M7Oerl sdHG/fk0pZ32gudb/B2GPZ+iAxhxwdTqfGOZSEUMlguMGSBe8WotDvPSckHR3Y6tkjDT Db/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=RRArD+lq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h17-20020aa786d1000000b00690de92ffe3si8735785pfo.309.2023.09.24.23.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 23:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=RRArD+lq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D22E5816AF23; Sun, 24 Sep 2023 20:59:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232036AbjIYD7G (ORCPT + 99 others); Sun, 24 Sep 2023 23:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbjIYD6q (ORCPT ); Sun, 24 Sep 2023 23:58:46 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE10196 for ; Sun, 24 Sep 2023 20:58:20 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-7742da399a2so112891685a.0 for ; Sun, 24 Sep 2023 20:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1695614300; x=1696219100; darn=vger.kernel.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=hww7oOWxGKb7qmsb0mmM2P/enCFKvkDkB3bMeqs1n3g=; b=RRArD+lq7BAqvn+uNyaKKRU/d7BtdrC2ePuy6kCotmdPQirRoJkgG7oR+E9Y3wf2J/ oRPJK3BsKoN6SBn/k45+yWcoqfLgeM9NU906qIli0i5PvUp4pdzWjG7Gv5cSXLoKpGa+ UxOYVavUcrag2xB434jAOsZz/js39Xk/6dBWE0SkBylMjMsAYChYR8XbZEdxCG56MXn4 1+Ne3+C6M10pZCMmDdK5NMIizrHXkAMICm7EJjfMmTjci4vUVRRic9nasg1MKIin7hK4 N/GngCG870M5cItWkLwyuB3yFcowXnr0+evOV3w0Q4sJd9NWfGfqDF0tiuxsnUyGDQdd B0Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695614300; x=1696219100; 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=hww7oOWxGKb7qmsb0mmM2P/enCFKvkDkB3bMeqs1n3g=; b=nZAHp01xE3ac/v94wPdJhKovawkQiMroPLyvPL3r1LC7AT5wENT6bjPpYI34ycpyOt ZgbKiPpNh94Sr00Pl0lOhbq5oK/7FvpO5IwfNVZSaeuRuBbpmTy/thbVzM9myrhRZ/VE KlIrZ0V2aunaiTpYxEHSFAZ2ne2zfXdeeb2k7QOKN3nZ5ZLcbRY1kRWjwupz3DlxqxqT LtMj5nTOpZwZesjGftzdI2pMhMC4CUhs/KdkBXMrIIm2uTLK2KCWNPuwL/bJfNEkuswh 6POsiOuPyb4l2VvEzXdHyZXP6Gyjihjl88mUik41cXwKoS73y0wsUyvWIMzSe51NMKso DvvA== X-Gm-Message-State: AOJu0YyyVEn2TXTlDOwzyRTNwiYb/Nio65vqjDt7eG3UR7/40lQR//lw PMrlYIrCoN036l6hGO0g6bxeFw== X-Received: by 2002:a05:620a:1987:b0:774:2c35:3796 with SMTP id bm7-20020a05620a198700b007742c353796mr3484182qkb.34.1695614300078; Sun, 24 Sep 2023 20:58:20 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id fm1-20020a056a002f8100b00679a4b56e41sm7025387pfb.43.2023.09.24.20.58.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 24 Sep 2023 20:58:19 -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 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 v3 5/9] maple_tree: Update the documentation of maple tree Date: Mon, 25 Sep 2023 11:56:13 +0800 Message-Id: <20230925035617.84767-6-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230925035617.84767-1-zhangpeng.00@bytedance.com> References: <20230925035617.84767-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 24 Sep 2023 20:59:08 -0700 (PDT) Introduce the new interface mtree_dup() in the documentation. Signed-off-by: Peng Zhang --- 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 45defcf15da7..3d8a1edf6d04 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 identical 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() -- 2.20.1