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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AA6CC46CA1 for ; Tue, 17 Oct 2023 02:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233444AbjJQCp2 (ORCPT ); Mon, 16 Oct 2023 22:45:28 -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-Google-Smtp-Source: AGHT+IH2Vaw5VpFjLCYEuyg5TbbuvFfpk2Jx9OW/8sn5hwvVrjx7wStSOHagOF7B9oUE06Cu0PJvrA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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. > >