From dd6af5b80424cb6a2414bed3f4cbdbcc30be7e58 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 23 Feb 2004 04:42:36 -0800 Subject: [PATCH] [PATCH] ppc64: Add DEBUG_STACK_USAGE From: Anton Blanchard Add DEBUG_STACK_USAGE to ppc64 --- arch/ppc64/Kconfig | 9 +++++++++ include/asm-ppc64/thread_info.h | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig index 0e177601c2c4e..276071ecf3600 100644 --- a/arch/ppc64/Kconfig +++ b/arch/ppc64/Kconfig @@ -316,6 +316,15 @@ config DEBUG_KERNEL Say Y here if you are developing drivers or trying to debug and identify kernel problems. +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 DEBUG_SLAB bool "Debug memory allocations" depends on DEBUG_KERNEL diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h index b7280fbb2dae7..5b74b149f04f7 100644 --- a/include/asm-ppc64/thread_info.h +++ b/include/asm-ppc64/thread_info.h @@ -11,6 +11,7 @@ #ifdef __KERNEL__ #ifndef __ASSEMBLY__ +#include #include #include @@ -51,7 +52,19 @@ struct thread_info { #define THREAD_ORDER 2 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER) -#define alloc_thread_info(task) ((struct thread_info *)kmalloc(THREAD_SIZE, GFP_KERNEL)) +#ifdef CONFIG_DEBUG_STACK_USAGE +#define alloc_thread_info(tsk) \ + ({ \ + struct thread_info *ret; \ + \ + ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ + if (ret) \ + memset(ret, 0, THREAD_SIZE); \ + ret; \ + }) +#else +#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) +#endif #define free_thread_info(ti) kfree(ti) #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) -- 2.53.0