* [PATCH] kmemtrace: SLUB hooks for caller-tracking functions.
@ 2008-08-24 17:49 Eduard - Gabriel Munteanu
2008-08-31 14:35 ` Pekka Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Eduard - Gabriel Munteanu @ 2008-08-24 17:49 UTC (permalink / raw)
To: penberg
Cc: linux-kernel, linux-mm, rdunlap, mpm, tglx, rostedt, cl,
mathieu.desnoyers, tzanussi, Eduard - Gabriel Munteanu
This patch adds kmemtrace hooks for __kmalloc_track_caller() and
__kmalloc_node_track_caller(). Currently, they set the call site pointer
to the value recieved as a parameter. (This could change if we implement
stack trace exporting in kmemtrace.)
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
mm/slub.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 06755e2..e79b814 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3254,6 +3254,7 @@ static struct notifier_block __cpuinitdata slab_notifier = {
void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller)
{
struct kmem_cache *s;
+ void *ret;
if (unlikely(size > PAGE_SIZE))
return kmalloc_large(size, gfpflags);
@@ -3263,13 +3264,21 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller)
if (unlikely(ZERO_OR_NULL_PTR(s)))
return s;
- return slab_alloc(s, gfpflags, -1, caller);
+ ret = slab_alloc(s, gfpflags, -1, caller);
+
+ /* Honor the call site pointer we recieved. */
+ kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC,
+ (unsigned long) caller, ret,
+ size, s->size, gfpflags);
+
+ return ret;
}
void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
int node, void *caller)
{
struct kmem_cache *s;
+ void *ret;
if (unlikely(size > PAGE_SIZE))
return kmalloc_large_node(size, gfpflags, node);
@@ -3279,7 +3288,14 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
if (unlikely(ZERO_OR_NULL_PTR(s)))
return s;
- return slab_alloc(s, gfpflags, node, caller);
+ ret = slab_alloc(s, gfpflags, node, caller);
+
+ /* Honor the call site pointer we recieved. */
+ kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
+ (unsigned long) caller, ret,
+ size, s->size, gfpflags, node);
+
+ return ret;
}
#ifdef CONFIG_SLUB_DEBUG
--
1.5.6.1
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kmemtrace: SLUB hooks for caller-tracking functions.
2008-08-24 17:49 [PATCH] kmemtrace: SLUB hooks for caller-tracking functions Eduard - Gabriel Munteanu
@ 2008-08-31 14:35 ` Pekka Enberg
2008-08-31 18:36 ` Eduard - Gabriel Munteanu
0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2008-08-31 14:35 UTC (permalink / raw)
To: Eduard - Gabriel Munteanu
Cc: linux-kernel, linux-mm, rdunlap, mpm, tglx, rostedt, cl,
mathieu.desnoyers, tzanussi
Eduard - Gabriel Munteanu wrote:
> This patch adds kmemtrace hooks for __kmalloc_track_caller() and
> __kmalloc_node_track_caller(). Currently, they set the call site pointer
> to the value recieved as a parameter. (This could change if we implement
> stack trace exporting in kmemtrace.)
>
> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Applied. I had to do some manual tweaking, so can you please
double-check the result:
http://git.kernel.org/?p=linux/kernel/git/penberg/slab-2.6.git;a=commitdiff;h=b9f1ecc6428f0ba391845b2ac7df8618da287e4f
Thanks!
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kmemtrace: SLUB hooks for caller-tracking functions.
2008-08-31 14:35 ` Pekka Enberg
@ 2008-08-31 18:36 ` Eduard - Gabriel Munteanu
2008-09-01 7:16 ` Pekka Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Eduard - Gabriel Munteanu @ 2008-08-31 18:36 UTC (permalink / raw)
To: Pekka Enberg
Cc: linux-kernel, linux-mm, rdunlap, mpm, tglx, rostedt, cl,
mathieu.desnoyers, tzanussi
On Sun, Aug 31, 2008 at 05:35:40PM +0300, Pekka Enberg wrote:
> Eduard - Gabriel Munteanu wrote:
>> This patch adds kmemtrace hooks for __kmalloc_track_caller() and
>> __kmalloc_node_track_caller(). Currently, they set the call site pointer
>> to the value recieved as a parameter. (This could change if we implement
>> stack trace exporting in kmemtrace.)
>> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
>
> Applied. I had to do some manual tweaking, so can you please double-check
> the result:
>
> http://git.kernel.org/?p=linux/kernel/git/penberg/slab-2.6.git;a=commitdiff;h=b9f1ecc6428f0ba391845b2ac7df8618da287e4f
>
> Thanks!
Looks fine to me. However, you can now remove the casts to unsigned long
from 'caller', i.e. "s/(unsigned long) caller/caller/g"
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kmemtrace: SLUB hooks for caller-tracking functions.
2008-08-31 18:36 ` Eduard - Gabriel Munteanu
@ 2008-09-01 7:16 ` Pekka Enberg
0 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2008-09-01 7:16 UTC (permalink / raw)
To: Eduard - Gabriel Munteanu
Cc: linux-kernel, linux-mm, rdunlap, mpm, tglx, rostedt, cl,
mathieu.desnoyers, tzanussi
Eduard - Gabriel Munteanu wrote:
> On Sun, Aug 31, 2008 at 05:35:40PM +0300, Pekka Enberg wrote:
>> Eduard - Gabriel Munteanu wrote:
>>> This patch adds kmemtrace hooks for __kmalloc_track_caller() and
>>> __kmalloc_node_track_caller(). Currently, they set the call site pointer
>>> to the value recieved as a parameter. (This could change if we implement
>>> stack trace exporting in kmemtrace.)
>>> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
>> Applied. I had to do some manual tweaking, so can you please double-check
>> the result:
>>
>> http://git.kernel.org/?p=linux/kernel/git/penberg/slab-2.6.git;a=commitdiff;h=b9f1ecc6428f0ba391845b2ac7df8618da287e4f
>>
>> Thanks!
>
> Looks fine to me. However, you can now remove the casts to unsigned long
> from 'caller', i.e. "s/(unsigned long) caller/caller/g"
Fixed, thanks!
http://git.kernel.org/?p=linux/kernel/git/penberg/slab-2.6.git;a=commitdiff;h=0fae99540ebb53e0507f2bd6e119bede94e84f77
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-01 7:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-24 17:49 [PATCH] kmemtrace: SLUB hooks for caller-tracking functions Eduard - Gabriel Munteanu
2008-08-31 14:35 ` Pekka Enberg
2008-08-31 18:36 ` Eduard - Gabriel Munteanu
2008-09-01 7:16 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox