From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org,
brauner@kernel.org, surenb@google.com,
michael.christie@oracle.com, peterz@infradead.org,
mathieu.desnoyers@efficios.com, npiggin@gmail.com,
avagin@gmail.com, linux-mm@kvack.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 0/6] Introduce __mt_dup() to improve the performance of fork()
Date: Thu, 7 Sep 2023 16:19:51 -0400 [thread overview]
Message-ID: <20230907201951.lfrbxd2wsrst6mso@revolver> (raw)
In-Reply-To: <20230830125654.21257-1-zhangpeng.00@bytedance.com>
* Peng Zhang <zhangpeng.00@bytedance.com> [230830 08:57]:
> In the process of duplicating mmap in fork(), VMAs will be inserted into the new
> maple tree one by one. When inserting into the maple tree, the maple tree will
> be rebalanced multiple times. The rebalancing of maple tree is not as fast as
> the rebalancing of red-black tree and will be slower. Therefore, __mt_dup() is
> introduced to directly duplicate the structure of the old maple tree, and then
> modify each element of the new maple tree. This avoids rebalancing and some extra
> copying, so is faster than the original method.
> More information can refer to [1].
Thanks for this patch set, it's really coming along nicely.
>
> There is a "spawn" in byte-unixbench[2], which can be used to test the performance
> of fork(). I modified it slightly to make it work with different number of VMAs.
>
> Below are the test numbers. There are 21 VMAs by default. The first row indicates
> the number of added VMAs. The following two lines are the number of fork() calls
> every 10 seconds. These numbers are different from the test results in v1 because
> this time the benchmark is bound to a CPU. This way the numbers are more stable.
>
> Increment of VMAs: 0 100 200 400 800 1600 3200 6400
> 6.5.0-next-20230829: 111878 75531 53683 35282 20741 11317 6110 3158
> Apply this patchset: 114531 85420 64541 44592 28660 16371 9038 4831
> +2.37% +13.09% +20.23% +26.39% +38.18% +44.66% +47.92% +52.98%
Can you run this with the default 21 as well?
>
> Todo:
> - Update the documentation.
>
> Changes since v1:
> - Reimplement __mt_dup() and mtree_dup(). Loops are implemented without using
> goto instructions.
> - The new tree also needs to be locked to avoid some lockdep warnings.
> - Drop and add some helpers.
I guess this also includes the changes to remove the new ways of finding
a node end and using that extra bit in the address? Those were
significant and welcome changes. Thanks.
> - Add test for duplicating full tree.
> - Drop mas_replace_entry(), it doesn't seem to have a big impact on the
> performance of fork().
>
> [1] https://lore.kernel.org/lkml/463899aa-6cbd-f08e-0aca-077b0e4e4475@bytedance.com/
> [2] https://github.com/kdlucas/byte-unixbench/tree/master
>
> v1: https://lore.kernel.org/lkml/20230726080916.17454-1-zhangpeng.00@bytedance.com/
>
> Peng Zhang (6):
> maple_tree: Add two helpers
> maple_tree: Introduce interfaces __mt_dup() and mtree_dup()
> maple_tree: Add test for mtree_dup()
> maple_tree: Skip other tests when BENCH is enabled
> maple_tree: Update check_forking() and bench_forking()
> fork: Use __mt_dup() to duplicate maple tree in dup_mmap()
>
> include/linux/maple_tree.h | 3 +
> kernel/fork.c | 34 ++-
> lib/maple_tree.c | 277 ++++++++++++++++++++++++-
> lib/test_maple_tree.c | 69 +++---
> mm/mmap.c | 14 +-
> tools/testing/radix-tree/maple.c | 346 +++++++++++++++++++++++++++++++
> 6 files changed, 697 insertions(+), 46 deletions(-)
>
> --
> 2.20.1
>
prev parent reply other threads:[~2023-09-07 20:20 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 12:56 [PATCH v2 0/6] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-08-30 12:56 ` [PATCH v2 1/6] maple_tree: Add two helpers Peng Zhang
2023-09-07 20:13 ` Liam R. Howlett
2023-09-08 2:45 ` Peng Zhang
2023-08-30 12:56 ` [PATCH v2 2/6] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Peng Zhang
2023-09-07 20:13 ` Liam R. Howlett
2023-09-08 9:26 ` Peng Zhang
2023-09-08 16:05 ` Liam R. Howlett
2023-09-11 12:59 ` Peng Zhang
2023-09-11 13:36 ` Liam R. Howlett
2023-08-30 12:56 ` [PATCH v2 3/6] maple_tree: Add test for mtree_dup() Peng Zhang
2023-09-07 20:13 ` Liam R. Howlett
2023-09-08 9:38 ` Peng Zhang
2023-09-25 4:06 ` Peng Zhang
2023-09-25 7:44 ` Liam R. Howlett
2023-09-25 8:30 ` Peng Zhang
2023-08-30 12:56 ` [PATCH v2 4/6] maple_tree: Skip other tests when BENCH is enabled Peng Zhang
2023-08-30 12:56 ` [PATCH v2 5/6] maple_tree: Update check_forking() and bench_forking() Peng Zhang
2023-08-31 13:40 ` kernel test robot
2023-09-01 10:58 ` Peng Zhang
2023-09-07 18:03 ` Liam R. Howlett
2023-09-07 18:16 ` Matthew Wilcox
2023-09-08 9:47 ` Peng Zhang
2023-09-07 20:14 ` Liam R. Howlett
2023-08-30 12:56 ` [PATCH v2 6/6] fork: Use __mt_dup() to duplicate maple tree in dup_mmap() Peng Zhang
2023-09-07 20:14 ` Liam R. Howlett
2023-09-08 9:58 ` Peng Zhang
2023-09-08 16:07 ` Liam R. Howlett
2023-09-15 10:51 ` Peng Zhang
2023-09-15 10:56 ` Peng Zhang
2023-09-15 20:00 ` Liam R. Howlett
2023-09-18 13:14 ` Peng Zhang
2023-09-18 17:59 ` Liam R. Howlett
2023-08-30 13:05 ` [PATCH v2 0/6] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-09-07 20:19 ` Liam R. Howlett [this message]
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=20230907201951.lfrbxd2wsrst6mso@revolver \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--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=mathieu.desnoyers@efficios.com \
--cc=michael.christie@oracle.com \
--cc=npiggin@gmail.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;
as well as URLs for NNTP newsgroup(s).