When offset == node_end is satisfied, go to the parent node, mas->max will not change. So there is no need to update min on the move. Signed-off-by: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx> --- lib/maple_tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 83441ef2e1f57..8bfa837b7b752 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4616,7 +4616,8 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, enum maple_type mt; void __rcu **slots; - if (mas->max >= max) + min = mas->max + 1; + if (min > max) goto no_entry; level = 0; @@ -4624,10 +4625,6 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node, if (ma_is_root(node)) goto no_entry; - min = mas->max + 1; - if (min > max) - goto no_entry; - if (unlikely(mas_ascend(mas))) return 1; -- 2.20.1