Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2890021rdg; Mon, 16 Oct 2023 19:45:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9EgfLbNTO+Ox6T+lHuTcV7KDgZgt8Yk+IW1hU2w00QB1e5UhxiDSKGoKtuH1VZFc6Dc6Q X-Received: by 2002:a05:6358:a5c:b0:12f:158e:ed88 with SMTP id 28-20020a0563580a5c00b0012f158eed88mr1130982rwb.22.1697510736144; Mon, 16 Oct 2023 19:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697510736; cv=none; d=google.com; s=arc-20160816; b=AvSlwHa//pWt1Bn3KPEoyg66nuT4bAKkFh/7nA+ZNZpFgG4+9DtM3JuWpDmjtkazbA SFr/LgcJkFgTRKJOXZCbChL7IX2zMb6ox3KMqATVvXhxe89wqTPMRmckCJHpuaQdDLxg hTpCXH6fvyFJin509nOnMkjJoKZVJ3igeB5XIoXZJCkl5yHdrlrCImzvbfbQiU1Y0+qr zs3Ghv3ys4ZRQvl50ATIi5MCyqP6JMrrcrKYupQdXwj8/wqigxoso67NsS8gxBePRC5b G/DYJHQzgiS/BBUvIERfQqYFbLkX9FoTwnShzEPpQuA7LuO0DUgdeYv1VYg29plfuld/ 6izw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=1vk6qsMWI9JY/rqTZgWzwRzv4ez7UHpwgeGAhF/8re0=; fh=pmgvzdpsBAQJ1TfrAy+uUexDne7OpIPHnqTwXgXYd2I=; b=PP2VuUEFjNxmWXBagdLMSyDsz3jpSKuIJZktmNBE6EgdmbPxQ+wP6Qyw0vn0Vsc9Pz mLNvQcnsd6xxdu/w3j6IVQpVyxNvBVCzrvwpDzlzuwbLKfwIdujjdWuqjliacQy9dPrq yQiu1FFPfWjqjwwQGF6CIfyY/piAff3vNkD7j6uW0wcN4UDj5NZiQTuvxB8tRHT5M4Vq M3hpTql5ZKV3mQlVEhKExSNaiNAej7r1GjFdz8WrLYp57aewOerLKN98M0U2TqzjSDUq MSgkG4mCt76rZsgSdMjJ6kEYYaZpR9jP8tZ1Gt8eNvxK8I3a3nrwDf6nnrC6fyXC0l/n tSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Eyoh5PeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o6-20020a639206000000b0058ae63187e5si716921pgd.830.2023.10.16.19.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 19:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Eyoh5PeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id E59A18047556; Mon, 16 Oct 2023 19:45:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbjJQCp0 (ORCPT + 99 others); Mon, 16 Oct 2023 22:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbjJQCpY (ORCPT ); Mon, 16 Oct 2023 22:45:24 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC33EA for ; Mon, 16 Oct 2023 19:45:00 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c0ecb9a075so34066405ad.2 for ; Mon, 16 Oct 2023 19:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697510700; x=1698115500; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=1vk6qsMWI9JY/rqTZgWzwRzv4ez7UHpwgeGAhF/8re0=; b=Eyoh5PeVdqjzSKHiYMOOTQU6z7bwOMwwRdrwYT7RJhIw29L9dm+Ls7rI5nYvp7HyMp JWe11euDQ8D+qDRRIT8rUXaMFlv+uMlkZCcWsWnlTkdZuh9ZHuvA+W7RLGYxQM7SbTIA G1wyOrbxTWiNTaxlnR2eUZ+LMuVgUEBzA+a3wm63YTKKL2B9XSoXXRzyYWRBwropBEDh fXICQs2qCr/XbF/Sq0K79dtgdkWom5TnIXdUfOQEnCpeUXKqFio0fEoJoBxFUL/rAsXr YqSXoxAc7Eq+SVyxJMKHpBGxg7h5C6iPt5X5YVSQIjBw/mbYevDR+ShmzNgw4n4XfDQb l0ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697510700; x=1698115500; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1vk6qsMWI9JY/rqTZgWzwRzv4ez7UHpwgeGAhF/8re0=; b=puoTmKWKXuIWOh3BSiJ0U9S9SVQPp4TA7+HzZpYybMcPO99FEyL1iOxwCLRB7RCy3N J/65/qVyWkZ7cd9TS1HdGUXN2tPnKCTCViaLYycG1elKjWPv1kxgyEXy5fDuPL8eXSoN 8PK0gw40KgppxRg+XVVPq0bxydFZjDatGvEoXkHjIa+Z7exkcMsJSu8egEnwK7+LWMi3 nF+2n9RaTqjr9KD2TmHDTsQ0ZUdM8aacVxXBensLHAsutc++09AUMiUxyRGKoXBKwIZQ XSjbRqXir1kGPub1TAxnzrnftjLf9ojkeAaoKEpbse013MxJ5GxrhvXyfNWJ7AjnEgp1 BXXg== X-Gm-Message-State: AOJu0Yx/wXsxh1BghwVz1JXjP+i9+PizN1AvPgFAlrEybYojHRGdwteu T2USFidGdTuZQF35J0bzuoQYmg== X-Received: by 2002:a17:903:280b:b0:1c6:3157:29f3 with SMTP id kp11-20020a170903280b00b001c6315729f3mr1001700plb.36.1697510699886; Mon, 16 Oct 2023 19:44:59 -0700 (PDT) Received: from [10.84.144.228] ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id jj19-20020a170903049300b001b8a2edab6asm295896plb.244.2023.10.16.19.44.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 19:44:59 -0700 (PDT) Message-ID: <1e2f1120-9889-445e-8b88-d7b6cb0e0843@bytedance.com> Date: Tue, 17 Oct 2023 10:44:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() To: Matthew Wilcox Cc: Liam.Howlett@oracle.com, corbet@lwn.net, akpm@linux-foundation.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, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Peng Zhang References: <20231016032226.59199-1-zhangpeng.00@bytedance.com> <20231016032226.59199-4-zhangpeng.00@bytedance.com> From: Peng Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 19:45:33 -0700 (PDT) 在 2023/10/16 22:10, Matthew Wilcox 写道: > On Mon, Oct 16, 2023 at 11:22:19AM +0800, Peng Zhang wrote: >> +++ b/lib/maple_tree.c >> @@ -4,6 +4,10 @@ >> * Copyright (c) 2018-2022 Oracle Corporation >> * Authors: Liam R. Howlett >> * Matthew Wilcox >> + * >> + * Algorithm for duplicating Maple Tree >> + * Copyright (c) 2023 ByteDance >> + * Author: Peng Zhang > > You can't copyright an algorithm. You can copyright the > _implementation_ of an algorithm. You have a significant chunk of code > in this file, so adding your copyright is reasonable (although not > legally required, AIUI). Just leave out this line: > > + * Algorithm for duplicating Maple Tree Okay, I will make the correction, thank you. > >> +/** >> + * __mt_dup(): Duplicate an entire maple tree >> + * @mt: The source maple tree >> + * @new: The new maple tree >> + * @gfp: The GFP_FLAGS to use for allocations >> + * >> + * This function duplicates a maple tree in Depth-First Search (DFS) pre-order >> + * traversal. It uses memcopy() to copy nodes in the source tree and allocate > > memcpy()? Yes, thank you for pointing this out. > >> +int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp) >> +{ >> + int ret = 0; >> + MA_STATE(mas, mt, 0, 0); >> + MA_STATE(new_mas, new, 0, 0); >> + >> + mas_dup_build(&mas, &new_mas, gfp); >> + >> + if (unlikely(mas_is_err(&mas))) { >> + ret = xa_err(mas.node); >> + if (ret == -ENOMEM) >> + mas_dup_free(&new_mas); >> + } >> + >> + return ret; >> +} >> +EXPORT_SYMBOL(__mt_dup); > > Why does it need to be exported? I consider __mt_dup() as a general interface for Maple Tree, uncertain whether it will be used by certain modules in the future. > >