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
Subject: Re: [PATCH 1/3] maple_tree: use ma_data_end() in mas_data_end()
Date: Tue, 3 Sep 2024 12:12:39 -0400 [thread overview]
Message-ID: <p7pa2opr5qr57xo5ndq3izstifds7qcb6z4gdcb62ilwdskq7c@wrspj6zavmhm> (raw)
In-Reply-To: <20240831001053.4751-1-richard.weiyang@gmail.com>
* Wei Yang <richard.weiyang@gmail.com> [240830 20:11]:
> These two function share almost the same code and do the same thing.
Please stop trying to optimise code like this. I don't have time to
verify you are not making things worse and you haven't done any of the
testing required.
I went through with perf to optimise dereferences and static inline
functions, so unless you are prepared to look at the generated code and
actually benchmark, please stop sending patches that I need to verify
like this myself.
>
> Let's just call ma_data_end() in mas_data_end() to reduce duplicate
> code.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
> lib/maple_tree.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index b7d747a7938e..85668246f944 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1435,28 +1435,14 @@ static __always_inline unsigned char ma_data_end(struct maple_node *node,
> */
> static inline unsigned char mas_data_end(struct ma_state *mas)
> {
> - enum maple_type type;
> - struct maple_node *node;
> - unsigned char offset;
> - unsigned long *pivots;
> -
> - type = mte_node_type(mas->node);
> - node = mas_mn(mas);
> - if (type == maple_arange_64)
> - return ma_meta_end(node, type);
> + enum maple_type type = mte_node_type(mas->node);
> + struct maple_node *node = mas_mn(mas);
> + unsigned long *pivots = ma_pivots(node, type);
>
> - pivots = ma_pivots(node, type);
> if (unlikely(ma_dead_node(node)))
> return 0;
>
> - offset = mt_pivots[type] - 1;
> - if (likely(!pivots[offset]))
> - return ma_meta_end(node, type);
> -
> - if (likely(pivots[offset] == mas->max))
> - return offset;
> -
> - return mt_pivots[type];
> + return ma_data_end(node, type, pivots, mas->max);
> }
>
> /*
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2024-09-03 16:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 0:10 Wei Yang
2024-08-31 0:10 ` [PATCH 2/3] maple_tree: use mas_safe_pivot() to get the pivot range Wei Yang
2024-09-04 0:41 ` Liam R. Howlett
2024-09-04 8:01 ` Wei Yang
2024-08-31 0:10 ` [PATCH 3/3] maple_tree: local variable 'count' is not necessary Wei Yang
2024-09-04 0:42 ` Liam R. Howlett
2024-09-03 16:12 ` Liam R. Howlett [this message]
2024-09-04 0:15 ` [PATCH 1/3] maple_tree: use ma_data_end() in mas_data_end() Wei Yang
2024-09-04 2:25 ` Liam R. Howlett
2024-09-04 7:58 ` Wei Yang
2024-09-04 14:53 ` Wei Yang
2024-09-05 20:13 ` Liam R. Howlett
2024-09-06 3:44 ` Wei Yang
2024-09-11 23:15 ` Wei Yang
2024-09-13 14:13 ` Liam R. Howlett
2024-09-14 0:50 ` Wei Yang
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=p7pa2opr5qr57xo5ndq3izstifds7qcb6z4gdcb62ilwdskq7c@wrspj6zavmhm \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=richard.weiyang@gmail.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