linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Matt Mackall <mpm@selenic.com>,
	linux-mm@kvack.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	"Bobniev, Roman" <Roman.Bobniev@sonymobile.com>
Cc: "Bird, Tim" <Tim.Bird@sonymobile.com>,
	"\"Andersson, Björn\"" <Bjorn.Andersson@sonymobile.com>
Subject: [PATCH] slub: Proper kmemleak tracking if CONFIG_SLUB_DEBUG disabled
Date: Fri, 27 Sep 2013 13:38:27 -0700	[thread overview]
Message-ID: <5245ECC3.8070200@gmail.com> (raw)

From: Roman Bobniev <roman.bobniev@sonymobile.com>

When kmemleak checking is enabled and CONFIG_SLUB_DEBUG is
disabled, the kmemleak code for small block allocation is
disabled.  This results in false kmemleak errors when memory
is freed.

Move the kmemleak code for small block allocation out from
under CONFIG_SLUB_DEBUG.

Signed-off-by: Roman Bobniev <roman.bobniev@sonymobile.com>
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
 mm/slub.c |    6 	3 +	3 -	0 !
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: b/mm/slub.c
===================================================================
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -947,13 +947,10 @@ static inline void slab_post_alloc_hook(
 {
 	flags &= gfp_allowed_mask;
 	kmemcheck_slab_alloc(s, flags, object, slab_ksize(s));
-	kmemleak_alloc_recursive(object, s->object_size, 1, s->flags, flags);
 }
 
 static inline void slab_free_hook(struct kmem_cache *s, void *x)
 {
-	kmemleak_free_recursive(x, s->flags);
-
 	/*
 	 * Trouble is that we may no longer disable interupts in the fast path
 	 * So in order to make the debug calls that expect irqs to be
@@ -2418,6 +2415,8 @@ redo:
 		memset(object, 0, s->object_size);
 
 	slab_post_alloc_hook(s, gfpflags, object);
+	kmemleak_alloc_recursive(object, s->objsize, 1, s->flags,
+				 gfpflags & gfp_allowed_mask);
 
 	return object;
 }
@@ -2614,6 +2613,7 @@ static __always_inline void slab_free(st
 	struct kmem_cache_cpu *c;
 	unsigned long tid;
 
+	kmemleak_free_recursive(x, s->flags);
 	slab_free_hook(s, x);
 
 redo:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2013-09-27 20:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 20:38 Frank Rowand [this message]
2013-09-30  9:04 ` [PATCH] slub: Proper kmemleak tracking if CONFIG_SLUB_DEBUG disabled Catalin Marinas
2013-10-02 14:41 ` Christoph Lameter
2013-10-02 15:33   ` Bird, Tim
2013-10-02 15:54     ` Catalin Marinas
2013-10-02 16:24       ` Christoph Lameter
2013-10-02 15:57     ` Christoph Lameter
2013-10-02 16:25       ` Catalin Marinas
  -- strict thread matches above, loose matches on Subject: below --
2013-10-08 22:37 [PATCH] slub: proper " Tim Bird
2013-10-08 22:58 Tim Bird
2013-10-09 13:28 ` Catalin Marinas
2013-10-09 19:07 ` Christoph Lameter
2013-10-23 11:52   ` Bobniev, Roman
2013-10-24 17:20     ` 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=5245ECC3.8070200@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=Bjorn.Andersson@sonymobile.com \
    --cc=Roman.Bobniev@sonymobile.com \
    --cc=Tim.Bird@sonymobile.com \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).