From cca33b03f9957f218beee4b83b714548c3afbc52 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Sun, 6 Dec 2020 19:59:15 -0500 Subject: [PATCH] maple_tree: Optimizer mas_node_walk() by removing special case. Check if offset is set is no longer necessary in the loop as it is done before. Also, check after checing index <= max. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 93ae822f17ae..deff629c347a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3019,14 +3019,21 @@ static inline void mas_node_walk(struct ma_state *mas, enum maple_type type, goto max; index = mas->index; + max = pivots[offset]; + if (index <= max) + goto done; + if (unlikely(!max && offset)) + goto max; + offset++; + min = max + 1; while (offset < count) { max = pivots[offset]; - if (unlikely(!max && offset)) - break; - if (index <= max) goto done; + if (unlikely(!max)) + break; + min = max + 1; offset++; } -- 2.50.1