From: Pekka Enberg <penberg@cs.helsinki.fi>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
penberg@cs.helsinki.fi, eduard.munteanu@linux360.ro,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:tracing/kmemtrace] kmemtrace: trace kfree() calls with NULL or zero-length objects
Date: Wed, 25 Mar 2009 09:45:54 GMT [thread overview]
Message-ID: <tip-ceff33f2fe894601b5e6805f88ea2b6a9622ce75@git.kernel.org> (raw)
In-Reply-To: <1237971957.30175.18.camel@penberg-laptop>
Commit-ID: ceff33f2fe894601b5e6805f88ea2b6a9622ce75
Gitweb: http://git.kernel.org/tip/ceff33f2fe894601b5e6805f88ea2b6a9622ce75
Author: Pekka Enberg <penberg@cs.helsinki.fi>
AuthorDate: Wed, 25 Mar 2009 11:05:57 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 25 Mar 2009 10:15:20 +0100
kmemtrace: trace kfree() calls with NULL or zero-length objects
Impact: also output kfree(NULL) entries
This patch moves the trace_kfree() calls before the ZERO_OR_NULL_PTR
check so that we can trace call-sites that call kfree() with NULL many
times which might be an indication of a bug.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
LKML-Reference: <1237971957.30175.18.camel@penberg-laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
mm/slab.c | 4 ++--
mm/slob.c | 4 ++--
mm/slub.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index fa00fd6..b584002 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3773,6 +3773,8 @@ void kfree(const void *objp)
struct kmem_cache *c;
unsigned long flags;
+ trace_kfree(_RET_IP_, objp);
+
if (unlikely(ZERO_OR_NULL_PTR(objp)))
return;
local_irq_save(flags);
@@ -3782,8 +3784,6 @@ void kfree(const void *objp)
debug_check_no_obj_freed(objp, obj_size(c));
__cache_free(c, (void *)objp);
local_irq_restore(flags);
-
- trace_kfree(_RET_IP_, objp);
}
EXPORT_SYMBOL(kfree);
diff --git a/mm/slob.c b/mm/slob.c
index 2ccd31d..5bd7ecc 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -503,6 +503,8 @@ void kfree(const void *block)
{
struct slob_page *sp;
+ trace_kfree(_RET_IP_, block);
+
if (unlikely(ZERO_OR_NULL_PTR(block)))
return;
@@ -513,8 +515,6 @@ void kfree(const void *block)
slob_free(m, *m + align);
} else
put_page(&sp->page);
-
- trace_kfree(_RET_IP_, block);
}
EXPORT_SYMBOL(kfree);
diff --git a/mm/slub.c b/mm/slub.c
index c3a905b..988ef33 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2791,6 +2791,8 @@ void kfree(const void *x)
struct page *page;
void *object = (void *)x;
+ trace_kfree(_RET_IP_, x);
+
if (unlikely(ZERO_OR_NULL_PTR(x)))
return;
@@ -2801,8 +2803,6 @@ void kfree(const void *x)
return;
}
slab_free(page->slab, page, object, _RET_IP_);
-
- trace_kfree(_RET_IP_, x);
}
EXPORT_SYMBOL(kfree);
next prev parent reply other threads:[~2009-03-25 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 9:05 [PATCH] kmemtrace: trace kfree() calls with NULL or zero-length objects Pekka Enberg
2009-03-25 9:45 ` Pekka Enberg [this message]
2009-04-03 10:37 ` [tip:tracing/kmemtrace-v2] " 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=tip-ceff33f2fe894601b5e6805f88ea2b6a9622ce75@git.kernel.org \
--to=penberg@cs.helsinki.fi \
--cc=eduard.munteanu@linux360.ro \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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