]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - lib/radix-tree.c
Merge tag 'xtensa-for-next-20140715' of git://github.com/jcmvbkbc/linux-xtensa into...
[karo-tx-linux.git] / lib / radix-tree.c
index 9599aa72d7a024795b300750e55147a60f58ed19..3291a8e37490ecc9d9221f389d26d02c0ae1f103 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/radix-tree.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
+#include <linux/kmemleak.h>
 #include <linux/notifier.h>
 #include <linux/cpu.h>
 #include <linux/string.h>
@@ -194,12 +195,17 @@ radix_tree_node_alloc(struct radix_tree_root *root)
                 * succeed in getting a node here (and never reach
                 * kmem_cache_alloc)
                 */
-               rtp = &__get_cpu_var(radix_tree_preloads);
+               rtp = this_cpu_ptr(&radix_tree_preloads);
                if (rtp->nr) {
                        ret = rtp->nodes[rtp->nr - 1];
                        rtp->nodes[rtp->nr - 1] = NULL;
                        rtp->nr--;
                }
+               /*
+                * Update the allocation stack trace as this is more useful
+                * for debugging.
+                */
+               kmemleak_update_trace(ret);
        }
        if (ret == NULL)
                ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
@@ -250,14 +256,14 @@ static int __radix_tree_preload(gfp_t gfp_mask)
        int ret = -ENOMEM;
 
        preempt_disable();
-       rtp = &__get_cpu_var(radix_tree_preloads);
+       rtp = this_cpu_ptr(&radix_tree_preloads);
        while (rtp->nr < ARRAY_SIZE(rtp->nodes)) {
                preempt_enable();
                node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
                if (node == NULL)
                        goto out;
                preempt_disable();
-               rtp = &__get_cpu_var(radix_tree_preloads);
+               rtp = this_cpu_ptr(&radix_tree_preloads);
                if (rtp->nr < ARRAY_SIZE(rtp->nodes))
                        rtp->nodes[rtp->nr++] = node;
                else
@@ -1296,7 +1302,6 @@ static inline void radix_tree_shrink(struct radix_tree_root *root)
 /**
  *     __radix_tree_delete_node    -    try to free node after clearing a slot
  *     @root:          radix tree root
- *     @index:         index key
  *     @node:          node containing @index
  *
  *     After clearing the slot at @index in @node from radix tree