]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Only zero request_count in mas_pop_node() if needed
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 9 Dec 2020 22:00:22 +0000 (17:00 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:36 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 9369487497a6bdf17cf47bc9a0c46cc1282c9624..8de0d2f574a7ce1cd35481244a858fc5c091a172 100644 (file)
@@ -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)