mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Zhang <zhangpeng.00@bytedance.com>
To: Matthew Wilcox <willy@infradead.org>
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 <zhangpeng.00@bytedance.com>
Subject: Re: [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and mtree_dup()
Date: Tue, 17 Oct 2023 10:44:49 +0800	[thread overview]
Message-ID: <1e2f1120-9889-445e-8b88-d7b6cb0e0843@bytedance.com> (raw)
In-Reply-To: <ZS1ESVpQ+vY0yDt4@casper.infradead.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 <Liam.Howlett@oracle.com>
>>    *	    Matthew Wilcox <willy@infradead.org>
>> + *
>> + * Algorithm for duplicating Maple Tree
>> + * Copyright (c) 2023 ByteDance
>> + * Author: Peng Zhang <zhangpeng.00@bytedance.com>
> 
> 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.
> 
> 

  reply	other threads:[~2023-10-17  2:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  3:22 [PATCH v5 00/10] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-10-16  3:22 ` [PATCH v5 01/10] maple_tree: Add mt_free_one() and mt_attr() helpers Peng Zhang
2023-10-16  3:22 ` [PATCH v5 02/10] maple_tree: Introduce {mtree,mas}_lock_nested() Peng Zhang
2023-10-16  3:22 ` [PATCH v5 03/10] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Peng Zhang
2023-10-16 14:10   ` Matthew Wilcox
2023-10-17  2:44     ` Peng Zhang [this message]
2023-10-17 13:57   ` Liam R. Howlett
2023-10-24  8:40     ` Peng Zhang
2023-10-16  3:22 ` [PATCH v5 04/10] radix tree test suite: Align kmem_cache_alloc_bulk() with kernel behavior Peng Zhang
2023-10-16  3:22 ` [PATCH v5 05/10] maple_tree: Add test for mtree_dup() Peng Zhang
2023-10-16  3:22 ` [PATCH v5 06/10] maple_tree: Update the documentation of maple tree Peng Zhang
2023-10-16  3:22 ` [PATCH v5 07/10] maple_tree: Skip other tests when BENCH is enabled Peng Zhang
2023-10-16  3:22 ` [PATCH v5 08/10] maple_tree: Update check_forking() and bench_forking() Peng Zhang
2023-10-16  3:22 ` [PATCH v5 09/10] maple_tree: Preserve the tree attributes when destroying maple tree Peng Zhang
2023-10-16  3:22 ` [PATCH v5 10/10] fork: Use __mt_dup() to duplicate maple tree in dup_mmap() Peng Zhang
2023-10-17 13:50   ` Liam R. Howlett
2023-10-24  8:45     ` Peng Zhang
2023-10-16  3:40 ` [PATCH v5 00/10] Introduce __mt_dup() to improve the performance of fork() Peng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e2f1120-9889-445e-8b88-d7b6cb0e0843@bytedance.com \
    --to=zhangpeng.00@bytedance.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=michael.christie@oracle.com \
    --cc=mjguzik@gmail.com \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=oliver.sang@intel.com \
    --cc=peterz@infradead.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®