]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 14 May 2014 00:02:04 +0000 (10:02 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 May 2014 00:02:04 +0000 (10:02 +1000)
Since radix_tree_preload() stack trace is not always useful for debugging
an actual radix tree memory leak, this patch updates the kmemleak
allocation stack trace in the radix_tree_node_alloc() function.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/radix-tree.c

index 55f7a9c2731248ba9b281fff5de7a98e868a5d5d..6ad8130f205321e6d3f2e74a9e6bdc32e82765ce 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>
@@ -200,6 +201,11 @@ radix_tree_node_alloc(struct radix_tree_root *root)
                        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);