From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, 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
Subject: Re: [PATCH v4 09/10] maple_tree: Preserve the tree attributes when destroying maple tree
Date: Wed, 11 Oct 2023 11:48:12 -0400 [thread overview]
Message-ID: <20231011154812.d26o6iqxflbmd2n3@revolver> (raw)
In-Reply-To: <1632d0e6-2d52-43b1-8a01-056231c0819d@bytedance.com>
* Peng Zhang <zhangpeng.00@bytedance.com> [231011 11:42]:
>
>
> 在 2023/10/9 17:03, Peng Zhang 写道:
> > When destroying maple tree, preserve its attributes and then turn it
> > into an empty tree. This allows it to be reused without needing to be
> > reinitialized.
> >
> > Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
> > ---
> > lib/maple_tree.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> > index d5544382ff15..1745242092fb 100644
> > --- a/lib/maple_tree.c
> > +++ b/lib/maple_tree.c
> > @@ -6775,7 +6775,7 @@ void __mt_destroy(struct maple_tree *mt)
> > if (xa_is_node(root))
> > mte_destroy_walk(root, mt);
> > - mt->ma_flags = 0;
> > + mt->ma_flags = mt_attr(mt)If I put everything into exit_mmap() for handling, this patch would
> not be necessary. But I think this patch is reasonable as it simply
> deletes all elements without requiring us to reinitialize the tree.
> What do you think?
Willy and I had debated if we should do what you have here a long time
ago. There was an issue with the next exit_mmap() that would not have
arose with this change, which I was going to make before it was made
unnecessary due to other changes in the caller.
In the strict thinking of a destroy() call, I would expect the flags to
not be spared, but doing this allows for an easy way to clear out a tree
and resuse it as you have said. I'm happy to keep this patch.
> > }
> > EXPORT_SYMBOL_GPL(__mt_destroy);
next prev parent reply other threads:[~2023-10-11 15:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 9:03 [PATCH v4 00/10] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-10-09 9:03 ` [PATCH v4 01/10] maple_tree: Add mt_free_one() and mt_attr() helpers Peng Zhang
2023-10-09 9:03 ` [PATCH v4 02/10] maple_tree: Introduce {mtree,mas}_lock_nested() Peng Zhang
2023-10-09 9:03 ` [PATCH v4 03/10] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Peng Zhang
2023-10-09 9:03 ` [PATCH v4 04/10] radix tree test suite: Align kmem_cache_alloc_bulk() with kernel behavior Peng Zhang
2023-10-09 9:03 ` [PATCH v4 05/10] maple_tree: Add test for mtree_dup() Peng Zhang
2023-10-09 9:03 ` [PATCH v4 06/10] maple_tree: Update the documentation of maple tree Peng Zhang
2023-10-09 9:03 ` [PATCH v4 07/10] maple_tree: Skip other tests when BENCH is enabled Peng Zhang
2023-10-09 9:03 ` [PATCH v4 08/10] maple_tree: Update check_forking() and bench_forking() Peng Zhang
2023-10-09 9:03 ` [PATCH v4 09/10] maple_tree: Preserve the tree attributes when destroying maple tree Peng Zhang
2023-10-11 15:42 ` Peng Zhang
2023-10-11 15:48 ` Liam R. Howlett [this message]
2023-10-09 9:03 ` [PATCH v4 10/10] fork: Use __mt_dup() to duplicate maple tree in dup_mmap() Peng Zhang
2023-10-09 11:06 ` Peng Zhang
2023-10-11 1:28 ` Liam R. Howlett
2023-10-11 7:00 ` Peng Zhang
2023-10-11 14:59 ` Liam R. Howlett
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=20231011154812.d26o6iqxflbmd2n3@revolver \
--to=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 \
--cc=zhangpeng.00@bytedance.com \
/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