2010-04-08 09:28:30

by Xiaotian Feng

[permalink] [raw]
Subject: [PATCH] slub: __kmalloc_node_track_caller should trace kmalloc_large_node case

commit 94b528d (kmemtrace: SLUB hooks for caller-tracking functions)
missed tracing kmalloc_large_node in __kmalloc_node_track_caller. We
should trace it same as __kmalloc_node.

Signed-off-by: Xiaotian Feng <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Matt Mackall <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Vegard Nossum <[email protected]>
---
mm/slub.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index b364844..a3a5a18 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3335,8 +3335,15 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
struct kmem_cache *s;
void *ret;

- if (unlikely(size > SLUB_MAX_SIZE))
- return kmalloc_large_node(size, gfpflags, node);
+ if (unlikely(size > SLUB_MAX_SIZE)) {
+ ret = kmalloc_large_node(size, gfpflags, node);
+
+ trace_kmalloc_node(caller, ret,
+ size, PAGE_SIZE << get_order(size),
+ gfpflags, node);
+
+ return ret;
+ }

s = get_slab(size, gfpflags);

--
1.7.0.1


2010-04-08 19:03:19

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] slub: __kmalloc_node_track_caller should trace kmalloc_large_node case

On Thu, 8 Apr 2010, Xiaotian Feng wrote:

> commit 94b528d (kmemtrace: SLUB hooks for caller-tracking functions)
> missed tracing kmalloc_large_node in __kmalloc_node_track_caller. We
> should trace it same as __kmalloc_node.
>
> Signed-off-by: Xiaotian Feng <[email protected]>
> Cc: Pekka Enberg <[email protected]>
> Cc: Matt Mackall <[email protected]>
> Cc: David Rientjes <[email protected]>

Acked-by: David Rientjes <[email protected]>

> Cc: Ingo Molnar <[email protected]>
> Cc: Vegard Nossum <[email protected]>
> ---
> mm/slub.c | 11 +++++++++--
> 1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index b364844..a3a5a18 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3335,8 +3335,15 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
> struct kmem_cache *s;
> void *ret;
>
> - if (unlikely(size > SLUB_MAX_SIZE))
> - return kmalloc_large_node(size, gfpflags, node);
> + if (unlikely(size > SLUB_MAX_SIZE)) {
> + ret = kmalloc_large_node(size, gfpflags, node);
> +
> + trace_kmalloc_node(caller, ret,
> + size, PAGE_SIZE << get_order(size),
> + gfpflags, node);
> +
> + return ret;
> + }
>
> s = get_slab(size, gfpflags);
>

2010-04-11 06:40:56

by Pekka Enberg

[permalink] [raw]
Subject: Re: [PATCH] slub: __kmalloc_node_track_caller should trace kmalloc_large_node case

David Rientjes wrote:
> On Thu, 8 Apr 2010, Xiaotian Feng wrote:
>
>> commit 94b528d (kmemtrace: SLUB hooks for caller-tracking functions)
>> missed tracing kmalloc_large_node in __kmalloc_node_track_caller. We
>> should trace it same as __kmalloc_node.
>>
>> Signed-off-by: Xiaotian Feng <[email protected]>
>> Cc: Pekka Enberg <[email protected]>
>> Cc: Matt Mackall <[email protected]>
>> Cc: David Rientjes <[email protected]>
>
> Acked-by: David Rientjes <[email protected]>
>
>> Cc: Ingo Molnar <[email protected]>
>> Cc: Vegard Nossum <[email protected]>
>> ---
>> mm/slub.c | 11 +++++++++--
>> 1 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index b364844..a3a5a18 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -3335,8 +3335,15 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
>> struct kmem_cache *s;
>> void *ret;
>>
>> - if (unlikely(size > SLUB_MAX_SIZE))
>> - return kmalloc_large_node(size, gfpflags, node);
>> + if (unlikely(size > SLUB_MAX_SIZE)) {
>> + ret = kmalloc_large_node(size, gfpflags, node);
>> +
>> + trace_kmalloc_node(caller, ret,
>> + size, PAGE_SIZE << get_order(size),
>> + gfpflags, node);
>> +
>> + return ret;
>> + }
>>
>> s = get_slab(size, gfpflags);
>>

Applied, thanks!