Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option

On parisc and metag the stack grows upwards, so for those we need to
scan the stack downwards in order to calculate how much stack a process
has used.

Tested on a 64bit parisc kernel.

Signed-off-by: Helge Deller <deller@gmx.de>

+9 -1
+8
include/linux/sched.h
··· 2870 2870 unsigned long *n = end_of_stack(p); 2871 2871 2872 2872 do { /* Skip over canary */ 2873 + # ifdef CONFIG_STACK_GROWSUP 2874 + n--; 2875 + # else 2873 2876 n++; 2877 + # endif 2874 2878 } while (!*n); 2875 2879 2880 + # ifdef CONFIG_STACK_GROWSUP 2881 + return (unsigned long)end_of_stack(p) - (unsigned long)n; 2882 + # else 2876 2883 return (unsigned long)n - (unsigned long)end_of_stack(p); 2884 + # endif 2877 2885 } 2878 2886 #endif 2879 2887 extern void set_task_stack_end_magic(struct task_struct *tsk);
+1 -1
lib/Kconfig.debug
··· 558 558 559 559 config DEBUG_STACK_USAGE 560 560 bool "Stack utilization instrumentation" 561 - depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG 561 + depends on DEBUG_KERNEL && !IA64 562 562 help 563 563 Enables the display of the minimum amount of free stack which each 564 564 task has ever had available in the sysrq-T and sysrq-P debug output.