Skip to content

Commit

Permalink
[PATCH] x86_64: x86_64 stack usage debugging
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Jun 26, 2006
1 parent 4961f10 commit 8501a2f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86_64/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
13 changes: 13 additions & 0 deletions include/asm-x86_64/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
Expand Down

0 comments on commit 8501a2f

Please sign in to comment.