Commit 6c31da34 authored by Helge Deller's avatar Helge Deller

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: default avatarHelge Deller <deller@gmx.de>
parent 56649be9
...@@ -2870,10 +2870,18 @@ static inline unsigned long stack_not_used(struct task_struct *p) ...@@ -2870,10 +2870,18 @@ static inline unsigned long stack_not_used(struct task_struct *p)
unsigned long *n = end_of_stack(p); unsigned long *n = end_of_stack(p);
do { /* Skip over canary */ do { /* Skip over canary */
# ifdef CONFIG_STACK_GROWSUP
n--;
# else
n++; n++;
# endif
} while (!*n); } 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); return (unsigned long)n - (unsigned long)end_of_stack(p);
# endif
} }
#endif #endif
extern void set_task_stack_end_magic(struct task_struct *tsk); extern void set_task_stack_end_magic(struct task_struct *tsk);
......
...@@ -558,7 +558,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF ...@@ -558,7 +558,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
config DEBUG_STACK_USAGE config DEBUG_STACK_USAGE
bool "Stack utilization instrumentation" bool "Stack utilization instrumentation"
depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG depends on DEBUG_KERNEL && !IA64
help help
Enables the display of the minimum amount of free stack which each 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. task has ever had available in the sysrq-T and sysrq-P debug output.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment