linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cleanup mast_split_data()
@ 2024-09-15  1:25 Wei Yang
  2024-09-15  1:25 ` [PATCH 1/2] maple_tree: the new max of left side subtree has been set Wei Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wei Yang @ 2024-09-15  1:25 UTC (permalink / raw)
  To: akpm, Liam.Howlett; +Cc: maple-tree, linux-mm, Wei Yang

There are two possible redundant code:

1. the left subtree's mas is set in mab_mas_cp()
2. the right subtree's pivot 0 would be set again in mab_mas_cp()

We can remove them.

Wei Yang (2):
  maple_tree: the new max of left side subtree has been set
  maple_tree: not necessary to set pivot 0 before mab_mas_cp()

 lib/maple_tree.c | 2 --
 1 file changed, 2 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] maple_tree: the new max of left side subtree has been set
  2024-09-15  1:25 [PATCH 0/2] cleanup mast_split_data() Wei Yang
@ 2024-09-15  1:25 ` Wei Yang
  2024-09-15  1:25 ` [PATCH 2/2] maple_tree: not necessary to set pivot 0 before mab_mas_cp() Wei Yang
  2024-12-02 17:32 ` [PATCH 0/2] cleanup mast_split_data() Liam R. Howlett
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2024-09-15  1:25 UTC (permalink / raw)
  To: akpm, Liam.Howlett; +Cc: maple-tree, linux-mm, Wei Yang

The max value has been updated in mab_mas_cp() on copying the left part.

Not necessary to update it again.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 lib/maple_tree.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 75e294d97e51..31964c5c677a 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3177,7 +3177,6 @@ static inline void mast_split_data(struct maple_subtree_state *mast,
 	mte_set_pivot(mast->r->node, 0, mast->r->max);
 	mab_mas_cp(mast->bn, split + 1, mast->bn->b_end, mast->r, false);
 	mast->l->offset = mte_parent_slot(mas->node);
-	mast->l->max = mast->bn->pivot[split];
 	mast->r->min = mast->l->max + 1;
 	if (mte_is_leaf(mas->node))
 		return;
-- 
2.34.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] maple_tree: not necessary to set pivot 0 before mab_mas_cp()
  2024-09-15  1:25 [PATCH 0/2] cleanup mast_split_data() Wei Yang
  2024-09-15  1:25 ` [PATCH 1/2] maple_tree: the new max of left side subtree has been set Wei Yang
@ 2024-09-15  1:25 ` Wei Yang
  2024-12-02 17:32 ` [PATCH 0/2] cleanup mast_split_data() Liam R. Howlett
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2024-09-15  1:25 UTC (permalink / raw)
  To: akpm, Liam.Howlett; +Cc: maple-tree, linux-mm, Wei Yang

mab_mas_cp() at least copy one pivot, which is pivot 0. This means the
pivot 0 set by mte_set_pivot() will be overwritten.

Just remote this redundant code.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 lib/maple_tree.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 31964c5c677a..b02d812e1489 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3174,7 +3174,6 @@ static inline void mast_split_data(struct maple_subtree_state *mast,
 	unsigned char p_slot;
 
 	mab_mas_cp(mast->bn, 0, split, mast->l, true);
-	mte_set_pivot(mast->r->node, 0, mast->r->max);
 	mab_mas_cp(mast->bn, split + 1, mast->bn->b_end, mast->r, false);
 	mast->l->offset = mte_parent_slot(mas->node);
 	mast->r->min = mast->l->max + 1;
-- 
2.34.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] cleanup mast_split_data()
  2024-09-15  1:25 [PATCH 0/2] cleanup mast_split_data() Wei Yang
  2024-09-15  1:25 ` [PATCH 1/2] maple_tree: the new max of left side subtree has been set Wei Yang
  2024-09-15  1:25 ` [PATCH 2/2] maple_tree: not necessary to set pivot 0 before mab_mas_cp() Wei Yang
@ 2024-12-02 17:32 ` Liam R. Howlett
  2024-12-02 22:14   ` Wei Yang
  2 siblings, 1 reply; 5+ messages in thread
From: Liam R. Howlett @ 2024-12-02 17:32 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, maple-tree, linux-mm

* Wei Yang <richard.weiyang@gmail.com> [240914 21:26]:
> There are two possible redundant code:
> 
> 1. the left subtree's mas is set in mab_mas_cp()
> 2. the right subtree's pivot 0 would be set again in mab_mas_cp()
> 
> We can remove them.

Is there any measurable difference with these changes?

> 
> Wei Yang (2):
>   maple_tree: the new max of left side subtree has been set
>   maple_tree: not necessary to set pivot 0 before mab_mas_cp()
> 
>  lib/maple_tree.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] cleanup mast_split_data()
  2024-12-02 17:32 ` [PATCH 0/2] cleanup mast_split_data() Liam R. Howlett
@ 2024-12-02 22:14   ` Wei Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2024-12-02 22:14 UTC (permalink / raw)
  To: Liam R. Howlett, Wei Yang, akpm, maple-tree, linux-mm

On Mon, Dec 02, 2024 at 12:32:43PM -0500, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [240914 21:26]:
>> There are two possible redundant code:
>> 
>> 1. the left subtree's mas is set in mab_mas_cp()
>> 2. the right subtree's pivot 0 would be set again in mab_mas_cp()
>> 
>> We can remove them.
>
>Is there any measurable difference with these changes?
>

I guess no.

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-05 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-15  1:25 [PATCH 0/2] cleanup mast_split_data() Wei Yang
2024-09-15  1:25 ` [PATCH 1/2] maple_tree: the new max of left side subtree has been set Wei Yang
2024-09-15  1:25 ` [PATCH 2/2] maple_tree: not necessary to set pivot 0 before mab_mas_cp() Wei Yang
2024-12-02 17:32 ` [PATCH 0/2] cleanup mast_split_data() Liam R. Howlett
2024-12-02 22:14   ` Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox