From: Catalin Marinas <catalin.marinas@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
Christoph Lameter <cl@linux-foundation.org>
Subject: [PATCH 05/14] kmemleak: Add the slub memory allocation/freeing hooks
Date: Fri, 24 Apr 2009 17:41:26 +0100 [thread overview]
Message-ID: <20090424164126.4476.88292.stgit@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <20090424163500.4476.62146.stgit@pc1117.cambridge.arm.com>
This patch adds the callbacks to kmemleak_(alloc|free) functions from the
slub allocator.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
mm/slub.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 7ab54ec..93f5fb0 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -19,6 +19,7 @@
#include <trace/kmemtrace.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
+#include <linux/kmemleak.h>
#include <linux/mempolicy.h>
#include <linux/ctype.h>
#include <linux/debugobjects.h>
@@ -142,7 +143,7 @@
* Set of flags that will prevent slab merging
*/
#define SLUB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
- SLAB_TRACE | SLAB_DESTROY_BY_RCU)
+ SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE)
#define SLUB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
SLAB_CACHE_DMA)
@@ -1614,6 +1615,7 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
if (unlikely((gfpflags & __GFP_ZERO) && object))
memset(object, 0, objsize);
+ kmemleak_alloc_recursive(object, objsize, 1, s->flags, gfpflags);
return object;
}
@@ -1743,6 +1745,7 @@ static __always_inline void slab_free(struct kmem_cache *s,
struct kmem_cache_cpu *c;
unsigned long flags;
+ kmemleak_free_recursive(x, s->flags);
local_irq_save(flags);
c = get_cpu_slab(s, smp_processor_id());
debug_check_no_locks_freed(object, c->objsize);
next prev parent reply other threads:[~2009-04-24 16:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 16:40 [PATCH 00/14] Kernel memory leak detector Catalin Marinas
2009-04-24 16:41 ` [PATCH 01/14] kmemleak: Add the base support Catalin Marinas
2009-04-24 16:41 ` [PATCH 02/14] kmemleak: Add documentation on the memory leak detector Catalin Marinas
2009-04-24 16:41 ` [PATCH 03/14] kmemleak: Add the slab memory allocation/freeing hooks Catalin Marinas
2009-04-24 16:41 ` [PATCH 04/14] kmemleak: Add the slob " Catalin Marinas
2009-04-24 16:41 ` Catalin Marinas [this message]
2009-04-24 16:41 ` [PATCH 06/14] kmemleak: Add the vmalloc " Catalin Marinas
2009-04-24 16:41 ` [PATCH 07/14] kmemleak: Add kmemleak_alloc callback from alloc_large_system_hash Catalin Marinas
2009-04-24 16:41 ` [PATCH 08/14] kmemleak: Add modules support Catalin Marinas
2009-04-24 16:41 ` [PATCH 09/14] x86: Provide _sdata in the vmlinux_*.lds.S files Catalin Marinas
2009-04-26 11:13 ` Ingo Molnar
2009-04-24 16:41 ` [PATCH 10/14] arm: Provide _sdata and __bss_stop in the vmlinux.lds.S file Catalin Marinas
2009-04-24 16:42 ` [PATCH 11/14] kmemleak: Remove some of the kmemleak false positives Catalin Marinas
2009-04-24 16:42 ` [PATCH 12/14] kmemleak: Enable the building of the memory leak detector Catalin Marinas
2009-04-24 23:02 ` David Rientjes
2009-04-27 11:19 ` Catalin Marinas
2009-04-24 16:42 ` [PATCH 13/14] kmemleak: Simple testing module for kmemleak Catalin Marinas
2009-04-24 16:42 ` [PATCH 14/14] kmemleak: Add the corresponding MAINTAINERS entry Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2008-12-19 18:12 [PATCH 00/14] Kernel memory leak detector Catalin Marinas
2008-12-19 18:13 ` [PATCH 05/14] kmemleak: Add the slub memory allocation/freeing hooks Catalin Marinas
2008-12-19 20:05 ` Pekka Enberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090424164126.4476.88292.stgit@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox