]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/mempool.c: update the kmemleak stack trace for mempool allocations
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 6 Jun 2014 21:38:19 +0000 (14:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jun 2014 23:08:17 +0000 (16:08 -0700)
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 <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mempool.c

index 455d468c3a5d6b5f3346a93477ffa8d61b2d6338..e209c98c72039b55afd1b5ca0b518e89094770a8 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/kmemleak.h>
 #include <linux/export.h>
 #include <linux/mempool.h>
 #include <linux/blkdev.h>
@@ -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;
        }