diff options
Diffstat (limited to 'lib/radix-tree.c')
-rw-r--r-- | lib/radix-tree.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 9599aa72d7a0..3291a8e37490 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/radix-tree.h> | 27 | #include <linux/radix-tree.h> |
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/kmemleak.h> | ||
30 | #include <linux/notifier.h> | 31 | #include <linux/notifier.h> |
31 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
32 | #include <linux/string.h> | 33 | #include <linux/string.h> |
@@ -194,12 +195,17 @@ radix_tree_node_alloc(struct radix_tree_root *root) | |||
194 | * succeed in getting a node here (and never reach | 195 | * succeed in getting a node here (and never reach |
195 | * kmem_cache_alloc) | 196 | * kmem_cache_alloc) |
196 | */ | 197 | */ |
197 | rtp = &__get_cpu_var(radix_tree_preloads); | 198 | rtp = this_cpu_ptr(&radix_tree_preloads); |
198 | if (rtp->nr) { | 199 | if (rtp->nr) { |
199 | ret = rtp->nodes[rtp->nr - 1]; | 200 | ret = rtp->nodes[rtp->nr - 1]; |
200 | rtp->nodes[rtp->nr - 1] = NULL; | 201 | rtp->nodes[rtp->nr - 1] = NULL; |
201 | rtp->nr--; | 202 | rtp->nr--; |
202 | } | 203 | } |
204 | /* | ||
205 | * Update the allocation stack trace as this is more useful | ||
206 | * for debugging. | ||
207 | */ | ||
208 | kmemleak_update_trace(ret); | ||
203 | } | 209 | } |
204 | if (ret == NULL) | 210 | if (ret == NULL) |
205 | ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); | 211 | ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); |
@@ -250,14 +256,14 @@ static int __radix_tree_preload(gfp_t gfp_mask) | |||
250 | int ret = -ENOMEM; | 256 | int ret = -ENOMEM; |
251 | 257 | ||
252 | preempt_disable(); | 258 | preempt_disable(); |
253 | rtp = &__get_cpu_var(radix_tree_preloads); | 259 | rtp = this_cpu_ptr(&radix_tree_preloads); |
254 | while (rtp->nr < ARRAY_SIZE(rtp->nodes)) { | 260 | while (rtp->nr < ARRAY_SIZE(rtp->nodes)) { |
255 | preempt_enable(); | 261 | preempt_enable(); |
256 | node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); | 262 | node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); |
257 | if (node == NULL) | 263 | if (node == NULL) |
258 | goto out; | 264 | goto out; |
259 | preempt_disable(); | 265 | preempt_disable(); |
260 | rtp = &__get_cpu_var(radix_tree_preloads); | 266 | rtp = this_cpu_ptr(&radix_tree_preloads); |
261 | if (rtp->nr < ARRAY_SIZE(rtp->nodes)) | 267 | if (rtp->nr < ARRAY_SIZE(rtp->nodes)) |
262 | rtp->nodes[rtp->nr++] = node; | 268 | rtp->nodes[rtp->nr++] = node; |
263 | else | 269 | else |
@@ -1296,7 +1302,6 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) | |||
1296 | /** | 1302 | /** |
1297 | * __radix_tree_delete_node - try to free node after clearing a slot | 1303 | * __radix_tree_delete_node - try to free node after clearing a slot |
1298 | * @root: radix tree root | 1304 | * @root: radix tree root |
1299 | * @index: index key | ||
1300 | * @node: node containing @index | 1305 | * @node: node containing @index |
1301 | * | 1306 | * |
1302 | * After clearing the slot at @index in @node from radix tree | 1307 | * After clearing the slot at @index in @node from radix tree |