From: Liam R. Howlett Date: Wed, 4 Nov 2020 02:33:58 +0000 (-0500) Subject: maple_tree: Optimize __mas_next a bit, I hope X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=829ae4d4a1ce03e5fc4aaa0772b49733e1260c5e;p=users%2Fjedix%2Flinux-maple.git maple_tree: Optimize __mas_next a bit, I hope Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 008d67678154..3981ec55a009 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3720,24 +3720,23 @@ static inline void *__mas_next(struct ma_state *mas, unsigned long limit, unsigned long *range_start) { void *entry = NULL; + struct maple_enode *prev_node; unsigned long index = mas->index; - unsigned char slot; mas->offset++; retry: *range_start = mas->last + 1; while (!mas_is_none(mas)) { - struct maple_enode *last_node = mas->node; - slot = mas->offset; - if (slot >= mt_slot_count(mas->node)) + if (mas->offset >= mt_slot_count(mas->node)) goto next_node; if (!mte_is_leaf(mas->node) || !mas->offset) { + prev_node = mas->node; *range_start = mas_first_entry(mas, limit); if (mas_is_none(mas)) { - mas->node = last_node; + mas->node = prev_node; goto next_node; } }