From bdcf7b15089a489933808600114d41510aece771 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 9 Dec 2020 17:00:22 -0500 Subject: [PATCH] maple_tree: Only zero request_count in mas_pop_node() if needed Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9369487497a6..8de0d2f574a7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -837,7 +837,7 @@ static inline struct maple_node *mas_pop_node(struct ma_state *mas) struct maple_alloc *ret, *node = mas->alloc; unsigned long total = mas_allocated(mas); - if (!total) // nothing or a request pending. + if (unlikely(!total)) // nothing or a request pending. return NULL; if (total == 1) { // single allocation in this ma_state @@ -861,9 +861,10 @@ single_node: new_head: ret->total = 0; ret->node_count = 0; - if (ret->request_count) + if (ret->request_count) { mas_set_alloc_req(mas, ret->request_count + 1); - ret->request_count = 0; + ret->request_count = 0; + } return (struct maple_node *)ret; } static inline void mas_push_node(struct ma_state *mas, struct maple_enode *used) -- 2.50.1