aboutsummaryrefslogtreecommitdiffstats
path: root/lib/radix-tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-08 14:31:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-08 14:31:16 -0400
commit3f17ea6dea8ba5668873afa54628a91aaa3fb1c0 (patch)
treeafbeb2accd4c2199ddd705ae943995b143a0af02 /lib/radix-tree.c
parent1860e379875dfe7271c649058aeddffe5afd9d0d (diff)
parent1a5700bc2d10cd379a795fd2bb377a190af5acd4 (diff)
Merge branch 'next' (accumulated 3.16 merge window patches) into master
Now that 3.15 is released, this merges the 'next' branch into 'master', bringing us to the normal situation where my 'master' branch is the merge window. * accumulated work in next: (6809 commits) ufs: sb mutex merge + mutex_destroy powerpc: update comments for generic idle conversion cris: update comments for generic idle conversion idle: remove cpu_idle() forward declarations nbd: zero from and len fields in NBD_CMD_DISCONNECT. mm: convert some level-less printks to pr_* MAINTAINERS: adi-buildroot-devel is moderated MAINTAINERS: add linux-api for review of API/ABI changes mm/kmemleak-test.c: use pr_fmt for logging fs/dlm/debug_fs.c: replace seq_printf by seq_puts fs/dlm/lockspace.c: convert simple_str to kstr fs/dlm/config.c: convert simple_str to kstr mm: mark remap_file_pages() syscall as deprecated mm: memcontrol: remove unnecessary memcg argument from soft limit functions mm: memcontrol: clean up memcg zoneinfo lookup mm/memblock.c: call kmemleak directly from memblock_(alloc|free) mm/mempool.c: update the kmemleak stack trace for mempool allocations lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations mm: introduce kmemleak_update_trace() mm/kmemleak.c: use %u to print ->checksum ...
Diffstat (limited to 'lib/radix-tree.c')
-rw-r--r--lib/radix-tree.c13
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