From be686aeee27d4c71b912c497b02a5f3c4b614245 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 6 Jun 2014 14:38:19 -0700 Subject: [PATCH] mm/mempool.c: update the kmemleak stack trace for mempool allocations When mempool_alloc() returns an existing pool object, kmemleak_alloc() is no longer called and the stack trace corresponds to the original object allocation. This patch updates the kmemleak allocation stack trace for such objects to make it more useful for debugging. Signed-off-by: Catalin Marinas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/mempool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/mempool.c b/mm/mempool.c index 455d468c3a5d6..e209c98c72039 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -222,6 +223,11 @@ repeat_alloc: spin_unlock_irqrestore(&pool->lock, flags); /* paired with rmb in mempool_free(), read comment there */ smp_wmb(); + /* + * Update the allocation stack trace as this is more useful + * for debugging. + */ + kmemleak_update_trace(element); return element; } -- 2.39.5