lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations

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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Catalin Marinas 2014-06-06 14:38:18 -07:00 committed by Linus Torvalds
parent ffe2c748e2
commit ce80b067de
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/kmemleak.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/string.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->nodes[rtp->nr - 1] = NULL;
rtp->nr--; rtp->nr--;
} }
/*
* Update the allocation stack trace as this is more useful
* for debugging.
*/
kmemleak_update_trace(ret);
} }
if (ret == NULL) if (ret == NULL)
ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);