From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org, Sidhartha Kumar <sidhartha.kumar@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: Re: [PATCH v3 2/3] maple_tree: add a test check deficient node
Date: Wed, 13 Nov 2024 13:40:01 -0500 [thread overview]
Message-ID: <wzcnqufzr5pmoxmsrhqdeo7cfas6o5g2um7yexuzxudacffjte@pc7v3y4sr5cr> (raw)
In-Reply-To: <20241113031616.10530-3-richard.weiyang@gmail.com>
* Wei Yang <richard.weiyang@gmail.com> [241112 22:17]:
> Add a test to assert when resulting a deficient node on splitting.
>
> We can achieve this by build a tree with two nodes. With the left
> node with consecutive data from 0 and leave some room for the final
> insert to locate in left node. And the right node a full node to force
> the split happens on the left node.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
> lib/test_maple_tree.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
> index 704cb1093ae8..72bda304b595 100644
> --- a/lib/test_maple_tree.c
> +++ b/lib/test_maple_tree.c
> @@ -1563,6 +1563,30 @@ static noinline void __init check_root_expand(struct maple_tree *mt)
> mas_unlock(&mas);
> }
>
> +static noinline void __init check_deficient_node(struct maple_tree *mt)
> +{
> + MA_STATE(mas, mt, 0, 0);
> + int count;
> +
> + mas_lock(&mas);
> + for (count = 0; count < 10; count++) {
> + mas_set(&mas, count);
> + mas_store_gfp(&mas, xa_mk_value(count), GFP_KERNEL);
> + }
> +
> + for (count = 20; count < 39; count++) {
> + mas_set(&mas, count);
> + mas_store_gfp(&mas, xa_mk_value(count), GFP_KERNEL);
> + }
> +
> + for (count = 10; count < 12; count++) {
> + mas_set(&mas, count);
> + mas_store_gfp(&mas, xa_mk_value(count), GFP_KERNEL);
> + }
> + mas_unlock(&mas);
> + mt_validate(mt);
> +}
> +
> static noinline void __init check_gap_combining(struct maple_tree *mt)
> {
> struct maple_enode *mn1, *mn2;
> @@ -3796,6 +3820,10 @@ static int __init maple_tree_seed(void)
> goto skip;
> #endif
>
> + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE);
> + check_deficient_node(&tree);
> + mtree_destroy(&tree);
> +
> mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE);
> check_store_null(&tree);
> mtree_destroy(&tree);
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-11-13 18:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 3:16 [PATCH v3 0/3] simplify split calculation Wei Yang
2024-11-13 3:16 ` [PATCH v3 1/3] maple_tree: " Wei Yang
2024-11-13 18:38 ` Liam R. Howlett
2024-11-13 3:16 ` [PATCH v3 2/3] maple_tree: add a test check deficient node Wei Yang
2024-11-13 18:40 ` Liam R. Howlett [this message]
2024-11-13 3:16 ` [PATCH v3 3/3] maple_tree: only root node could be deficient Wei Yang
2024-11-13 18:39 ` [PATCH v3 0/3] simplify split calculation Liam R. Howlett
2024-11-14 0:53 ` Wei Yang
2024-11-30 4:31 ` Andrew Morton
2024-12-01 2:02 ` 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=wzcnqufzr5pmoxmsrhqdeo7cfas6o5g2um7yexuzxudacffjte@pc7v3y4sr5cr \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=maple-tree@lists.infradead.org \
--cc=richard.weiyang@gmail.com \
--cc=sidhartha.kumar@oracle.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