diff options
author | Helge Deller <deller@gmx.de> | 2016-03-19 17:54:10 +0100 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2016-03-23 15:44:34 +0100 |
commit | 6c31da3464b4d28825d1827ee41a3a217b2dcf0e (patch) | |
tree | 6d001021e7a1cdcc6e07e59e9d311720370d4fef /include | |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 8 |
1 files changed, 8 insertions, 0 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) unsigned long *n = end_of_stack(p); do { /* Skip over canary */ +# ifdef CONFIG_STACK_GROWSUP + n--; +# else n++; +# endif } while (!*n); +# ifdef CONFIG_STACK_GROWSUP + return (unsigned long)end_of_stack(p) - (unsigned long)n; +# else return (unsigned long)n - (unsigned long)end_of_stack(p); +# endif } #endif extern void set_task_stack_end_magic(struct task_struct *tsk); |