mm/kmemleak: Do not skip stack frames
Subsystems (2)
PATCH 1/1 mm/kmemleak: Do not skip stack frames
From: Thierry Reding <[email protected]>
Trying to chase down memory leaks is much easier when the complete stack trace is available.
---
It seems like this was initially set to 1 when merged in commit 3c7b4e6b8be4 (kmemleak: Add the base support) and later increased to 2 in commit fd6789675ebf (kmemleak: Save the stack trace for early allocations). Perhaps there was a reason to skip the first few frames, but I've certainly found it difficult to find leaks when the stack trace doesn't point at the proper location.
--- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kmemleak.c +1 -1
@@ -503,7 +503,7 @@ static int __save_stack_trace(unsigned long *trace) stack_trace.max_entries =MAX_TRACE ; stack_trace.nr_entries =0 ; stack_trace.entries = trace; - stack_trace.skip =2 ; + stack_trace.skip =0 ;save_stack_trace (&stack_trace);return stack_trace.nr_entries;
Signature · 7 lines
2.1.2 -- 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>
Catalin Marinas
maintainerQuoted 22 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Trying to chase down memory leaks is much easier when the complete stack trace is available.
Signed-off-by Thierry Reding <[email protected]>---
It seems like this was initially set to 1 when merged in commit3c7b4e6b8be4(kmemleak: Add the base support) and later increased to 2 in commitfd6789675ebf(kmemleak: Save the stack trace for early allocations). Perhaps there was a reason to skip the first few frames, but I've certainly found it difficult to find leaks when the stack trace doesn't point at the proper location.--- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/kmemleak.c +0
-0
mm/kmemleak.c static int __save_stack_trace(unsigned long *trace) · line 506
Quoted 5 lines
mm/kmemleak.c +1
-1@@ -503,7 +503,7 @@ static int __save_stack_trace(unsigned long *trace) stack_trace.max_entries =MAX_TRACE ; stack_trace.nr_entries =0 ; stack_trace.entries = trace; - stack_trace.skip =2 ; + stack_trace.skip =0 ;
The reason for this was to avoid listing some of the kmemleak internals (kmemleak_alloc -> create_object -> __save_stack_trace). I can see how inlining of __save_stack_trace() would cause some of the last frames to be missed. I would still prefer to keep it at 1 rather than 0?
Which architecture are you testing on? What's the additional trace you get with this patch?
Signature · 1 line
Catalin