From 2f8f9cbf241e743bb1a6cfdb04e97131fecc7e79 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 12 Oct 2021 10:17:49 -0400 Subject: [PATCH] maple_tree: Optimize mas_node_walk() for reads only Now that only reads use mas_node_walk(), there are some situations which will not need to be checked. offset always starts at zero. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index eff82d9854841..0e65002fa26c6 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3679,23 +3679,17 @@ static inline void mas_node_walk(struct ma_state *mas, struct maple_node *node, return; } - offset = mas->offset; - min = mas_safe_min(mas, pivots, offset); + offset = 0; + min = mas->min; max = pivots[offset]; if (unlikely(ma_dead_node(node))) return; count = mt_pivots[type]; - if (unlikely(offset == count)) - goto max; - index = mas->index; if (unlikely(index <= max)) goto done; - if (unlikely(!max && offset)) - goto max; - offset++; min = max + 1; while (offset < count) { @@ -3713,7 +3707,6 @@ static inline void mas_node_walk(struct ma_state *mas, struct maple_node *node, offset++; } -max: max = mas->max; done: *range_max = max; -- 2.50.1