From: Liam R. Howlett Date: Mon, 7 Dec 2020 00:59:15 +0000 (-0500) Subject: maple_tree: Optimizer mas_node_walk() by removing special case. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cca33b03f9957f218beee4b83b714548c3afbc52;p=users%2Fjedix%2Flinux-maple.git 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 --- 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++; }