Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

maple_tree: Use kfree_rcu in ma_free_rcu

kfree_rcu is an optimized version of call_rcu + kfree. It used to not be
possible to call it on non-kmalloc objects, but this restriction was
lifted ever since SLOB was dropped from the kernel, and since commit
6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()").

Thus, replace call_rcu + mt_free_rcu with kfree_rcu.

Signed-off-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

authored by

Pedro Falcato and committed by
Vlastimil Babka
9b60811c 551a6e75

+3 -10
+3 -10
lib/maple_tree.c
··· 187 187 kmem_cache_free_bulk(maple_node_cache, size, (void **)nodes); 188 188 } 189 189 190 - static void mt_free_rcu(struct rcu_head *head) 191 - { 192 - struct maple_node *node = container_of(head, struct maple_node, rcu); 193 - 194 - kmem_cache_free(maple_node_cache, node); 195 - } 196 - 197 190 /* 198 191 * ma_free_rcu() - Use rcu callback to free a maple node 199 192 * @node: The node to free ··· 197 204 static void ma_free_rcu(struct maple_node *node) 198 205 { 199 206 WARN_ON(node->parent != ma_parent_ptr(node)); 200 - call_rcu(&node->rcu, mt_free_rcu); 207 + kfree_rcu(node, rcu); 201 208 } 202 209 203 210 static void mt_set_height(struct maple_tree *mt, unsigned char height) ··· 5092 5099 mt_free_bulk(node->slot_len, slots); 5093 5100 5094 5101 free_leaf: 5095 - mt_free_rcu(&node->rcu); 5102 + mt_free_one(node); 5096 5103 } 5097 5104 5098 5105 static inline void __rcu **mte_destroy_descend(struct maple_enode **enode, ··· 5176 5183 5177 5184 free_leaf: 5178 5185 if (free) 5179 - mt_free_rcu(&node->rcu); 5186 + mt_free_one(node); 5180 5187 else 5181 5188 mt_clear_meta(mt, node, node->type); 5182 5189 }