]> err.no Git - linux-2.6/commitdiff
[PATCH] x86_64: x86_64 stack usage debugging
authorEric Sandeen <sandeen@sgi.com>
Mon, 26 Jun 2006 12:00:08 +0000 (14:00 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 17:48:22 +0000 (10:48 -0700)
Applies to git & 2.6.17-rc6 after CONFIG_DEBUG_STACKOVERFLOW patch

uses same stack-zeroing mechanism as on i386 to discover maximum stack
excursions.

Signed-off-by: Eric Sandeen <sandeen@sgi.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/Kconfig.debug
include/asm-x86_64/thread_info.h

index 087a04868b25fe65ba700b1c3d5fa3a24def6295..1d92ab56c0f93fa06c4bf2b8f72bdbabb99ef782 100644 (file)
@@ -42,6 +42,15 @@ config DEBUG_STACKOVERFLOW
          This option will cause messages to be printed if free stack space
          drops below a certain limit.
 
+config DEBUG_STACK_USAGE
+        bool "Stack utilization instrumentation"
+        depends on DEBUG_KERNEL
+        help
+         Enables the display of the minimum amount of free stack which each
+         task has ever had available in the sysrq-T and sysrq-P debug output.
+
+         This option will slow down process creation somewhat.
+
 #config X86_REMOTE_DEBUG
 #       bool "kgdb debugging stub"
 
index b5e88216fd80da5c2915a8b5d3f23faaec54f4bb..2029b00351f3f6a1eb2e828bbb2a931d7910a1dd 100644 (file)
@@ -73,8 +73,21 @@ static inline struct thread_info *stack_thread_info(void)
 }
 
 /* thread information allocation */
+#ifdef CONFIG_DEBUG_STACK_USAGE
+#define alloc_thread_info(tsk)                                 \
+    ({                                                         \
+       struct thread_info *ret;                                \
+                                                               \
+       ret = ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)); \
+       if (ret)                                                \
+               memset(ret, 0, THREAD_SIZE);                    \
+       ret;                                                    \
+    })
+#else
 #define alloc_thread_info(tsk) \
        ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#endif
+
 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
 
 #else /* !__ASSEMBLY__ */