diff options
author | Helge Deller <deller@gmx.de> | 2016-03-19 12:54:10 -0400 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2016-03-23 10:44:34 -0400 |
commit | 6c31da3464b4d28825d1827ee41a3a217b2dcf0e (patch) | |
tree | 6d001021e7a1cdcc6e07e59e9d311720370d4fef | |
parent | 56649be9e67c17b4030fcc91ed6e1accc8e6918d (diff) |
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>
-rw-r--r-- | include/linux/sched.h | 8 | ||||
-rw-r--r-- | lib/Kconfig.debug | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 34495d2d2d7b..589c4780b077 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2870,10 +2870,18 @@ static inline unsigned long stack_not_used(struct task_struct *p) | |||
2870 | unsigned long *n = end_of_stack(p); | 2870 | unsigned long *n = end_of_stack(p); |
2871 | 2871 | ||
2872 | do { /* Skip over canary */ | 2872 | do { /* Skip over canary */ |
2873 | # ifdef CONFIG_STACK_GROWSUP | ||
2874 | n--; | ||
2875 | # else | ||
2873 | n++; | 2876 | n++; |
2877 | # endif | ||
2874 | } while (!*n); | 2878 | } while (!*n); |
2875 | 2879 | ||
2880 | # ifdef CONFIG_STACK_GROWSUP | ||
2881 | return (unsigned long)end_of_stack(p) - (unsigned long)n; | ||
2882 | # else | ||
2876 | return (unsigned long)n - (unsigned long)end_of_stack(p); | 2883 | return (unsigned long)n - (unsigned long)end_of_stack(p); |
2884 | # endif | ||
2877 | } | 2885 | } |
2878 | #endif | 2886 | #endif |
2879 | extern void set_task_stack_end_magic(struct task_struct *tsk); | 2887 | extern void set_task_stack_end_magic(struct task_struct *tsk); |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 532d4d52d1df..1e9a607534ca 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -558,7 +558,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF | |||
558 | 558 | ||
559 | config DEBUG_STACK_USAGE | 559 | config DEBUG_STACK_USAGE |
560 | bool "Stack utilization instrumentation" | 560 | bool "Stack utilization instrumentation" |
561 | depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG | 561 | depends on DEBUG_KERNEL && !IA64 |
562 | help | 562 | help |
563 | Enables the display of the minimum amount of free stack which each | 563 | Enables the display of the minimum amount of free stack which each |
564 | task has ever had available in the sysrq-T and sysrq-P debug output. | 564 | task has ever had available in the sysrq-T and sysrq-P debug output. |