Skip to contentSkip to conversation

slub: __kmalloc_node_track_caller should trace kmalloc_large_node case

PATCH Applied Xiaotian Feng 3 participants 3 messages Apr 8, 2010 – Apr 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

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(-)
mm/slub.c +9 -2
index b364844..a3a5a18 100644
@@ -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);
 
Signature · 7 lines
1.7.0.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Xiaotian Feng

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.

Cc Pekka Enberg <[email protected]>
Cc Matt Mackall <[email protected]>
Cc David Rientjes <[email protected]>
Quoted 18 lines
Cc Ingo Molnar <[email protected]>
Cc Vegard Nossum <[email protected]>
---
 mm/slub.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
index b364844..a3a5a18 100644
@@ -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);

mm/slub.c void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, · line 3349

Quoted 10 lines
mm/slub.c +7 -0
+
+		trace_kmalloc_node(caller, ret,
+				   size, PAGE_SIZE << get_order(size),
+				   gfpflags, node);
+
+		return ret;
+	}
 
 	s = get_slab(size, gfpflags);
 

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

Applied
#2 lore raw
Quoted 39 lines · David Rientjes
Quoted 8 lines · Xiaotian Feng

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.

Cc Pekka Enberg <[email protected]>
Cc Matt Mackall <[email protected]>
Cc David Rientjes <[email protected]>
Quoted 26 lines
Cc Ingo Molnar <[email protected]>
Cc Vegard Nossum <[email protected]>
---
 mm/slub.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
mm/slub.c +9 -2
index b364844..a3a5a18 100644
@@ -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;
+	}
 
Quoted 2 lines

mm/slub.c void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, · line 3349

Quoted 2 lines
mm/slub.c +0 -0
 	s = get_slab(size, gfpflags);
 

Applied, thanks!