* [PATCH] maple_tree: use mas_next_slot() directly
@ 2024-11-25 2:41 Wei Yang
2024-11-25 14:27 ` Liam R. Howlett
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2024-11-25 2:41 UTC (permalink / raw)
To: akpm, Liam.Howlett
Cc: maple-tree, linux-mm, Wei Yang, Liam R . Howlett,
Sidhartha Kumar, Lorenzo Stoakes
The loop condition makes sure (mas.last < max), so we can directly use
mas_next_slot() here.
Since no other use of mas_next_entry(), it is removed.
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>
---
lib/maple_tree.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index b67dae356182..7efb1520f9bd 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4733,29 +4733,6 @@ static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty)
return entry;
}
-/*
- * mas_next_entry() - Internal function to get the next entry.
- * @mas: The maple state
- * @limit: The maximum range start.
- *
- * Set the @mas->node to the next entry and the range_start to
- * the beginning value for the entry. Does not check beyond @limit.
- * Sets @mas->index and @mas->last to the range, Does not update @mas->index and
- * @mas->last on overflow.
- * Restarts on dead nodes.
- *
- * Return: the next entry or %NULL.
- */
-static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit)
-{
- if (mas->last >= limit) {
- mas->status = ma_overflow;
- return NULL;
- }
-
- return mas_next_slot(mas, limit, false);
-}
-
/*
* mas_rev_awalk() - Internal function. Reverse allocation walk. Find the
* highest gap address of a given size in a given node and descend.
@@ -6919,7 +6896,7 @@ void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max)
goto unlock;
while (mas_is_active(&mas) && (mas.last < max)) {
- entry = mas_next_entry(&mas, max);
+ entry = mas_next_slot(&mas, max, false);
if (likely(entry && !xa_is_zero(entry)))
break;
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] maple_tree: use mas_next_slot() directly
2024-11-25 2:41 [PATCH] maple_tree: use mas_next_slot() directly Wei Yang
@ 2024-11-25 14:27 ` Liam R. Howlett
0 siblings, 0 replies; 2+ messages in thread
From: Liam R. Howlett @ 2024-11-25 14:27 UTC (permalink / raw)
To: Wei Yang; +Cc: akpm, maple-tree, linux-mm, Sidhartha Kumar, Lorenzo Stoakes
* Wei Yang <richard.weiyang@gmail.com> [241124 21:42]:
> The loop condition makes sure (mas.last < max), so we can directly use
> mas_next_slot() here.
>
> Since no other use of mas_next_entry(), it is removed.
>
> 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/maple_tree.c | 25 +------------------------
> 1 file changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index b67dae356182..7efb1520f9bd 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4733,29 +4733,6 @@ static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty)
> return entry;
> }
>
> -/*
> - * mas_next_entry() - Internal function to get the next entry.
> - * @mas: The maple state
> - * @limit: The maximum range start.
> - *
> - * Set the @mas->node to the next entry and the range_start to
> - * the beginning value for the entry. Does not check beyond @limit.
> - * Sets @mas->index and @mas->last to the range, Does not update @mas->index and
> - * @mas->last on overflow.
> - * Restarts on dead nodes.
> - *
> - * Return: the next entry or %NULL.
> - */
> -static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit)
> -{
> - if (mas->last >= limit) {
> - mas->status = ma_overflow;
> - return NULL;
> - }
> -
> - return mas_next_slot(mas, limit, false);
> -}
> -
> /*
> * mas_rev_awalk() - Internal function. Reverse allocation walk. Find the
> * highest gap address of a given size in a given node and descend.
> @@ -6919,7 +6896,7 @@ void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max)
> goto unlock;
>
> while (mas_is_active(&mas) && (mas.last < max)) {
> - entry = mas_next_entry(&mas, max);
> + entry = mas_next_slot(&mas, max, false);
> if (likely(entry && !xa_is_zero(entry)))
> break;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-25 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 2:41 [PATCH] maple_tree: use mas_next_slot() directly Wei Yang
2024-11-25 14:27 ` Liam R. Howlett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox