From: Liam R. Howlett Date: Tue, 12 Oct 2021 14:17:49 +0000 (-0400) Subject: maple_tree: Optimize mas_node_walk() for reads only X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2f8f9cbf241e743bb1a6cfdb04e97131fecc7e79;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index eff82d985484..0e65002fa26c 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;