* [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option
@ 2016-03-19 16:54 ` Helge Deller
0 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2016-03-19 16:54 UTC (permalink / raw)
To: linux-parisc, James Bottomley, John David Anglin, James Hogan,
linux-metag, linux-ia64, linux-kernel
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>
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 084ed9f..71591f3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2859,10 +2859,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);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f28f7fa..901f96c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -546,7 +546,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
config DEBUG_STACK_USAGE
bool "Stack utilization instrumentation"
- depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
+ depends on DEBUG_KERNEL && !IA64
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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option
@ 2016-03-19 16:54 ` Helge Deller
0 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2016-03-19 16:54 UTC (permalink / raw)
To: linux-parisc, James Bottomley, John David Anglin, James Hogan,
linux-metag, linux-ia64, linux-kernel
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>
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 084ed9f..71591f3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2859,10 +2859,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);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f28f7fa..901f96c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -546,7 +546,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
config DEBUG_STACK_USAGE
bool "Stack utilization instrumentation"
- depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
+ depends on DEBUG_KERNEL && !IA64
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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option
2016-03-19 16:54 ` Helge Deller
(?)
@ 2016-04-29 22:04 ` James Hogan
-1 siblings, 0 replies; 5+ messages in thread
From: James Hogan @ 2016-04-29 22:04 UTC (permalink / raw)
To: Helge Deller
Cc: linux-parisc, James Bottomley, John David Anglin, linux-metag,
linux-ia64, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]
Hi Helge,
On Sat, Mar 19, 2016 at 05:54:10PM +0100, Helge Deller wrote:
> 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>
Looks good, and works on metag too!
Tested-by: James Hogan <james.hogan@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 084ed9f..71591f3 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2859,10 +2859,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);
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index f28f7fa..901f96c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -546,7 +546,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
>
> config DEBUG_STACK_USAGE
> bool "Stack utilization instrumentation"
> - depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
> + depends on DEBUG_KERNEL && !IA64
> 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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option
@ 2016-04-29 22:04 ` James Hogan
0 siblings, 0 replies; 5+ messages in thread
From: James Hogan @ 2016-04-29 22:04 UTC (permalink / raw)
To: Helge Deller
Cc: linux-parisc, James Bottomley, John David Anglin, linux-metag,
linux-ia64, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]
Hi Helge,
On Sat, Mar 19, 2016 at 05:54:10PM +0100, Helge Deller wrote:
> 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>
Looks good, and works on metag too!
Tested-by: James Hogan <james.hogan@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 084ed9f..71591f3 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2859,10 +2859,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);
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index f28f7fa..901f96c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -546,7 +546,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
>
> config DEBUG_STACK_USAGE
> bool "Stack utilization instrumentation"
> - depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
> + depends on DEBUG_KERNEL && !IA64
> 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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option
@ 2016-04-29 22:04 ` James Hogan
0 siblings, 0 replies; 5+ messages in thread
From: James Hogan @ 2016-04-29 22:04 UTC (permalink / raw)
To: Helge Deller
Cc: linux-parisc, James Bottomley, John David Anglin, linux-metag,
linux-ia64, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]
Hi Helge,
On Sat, Mar 19, 2016 at 05:54:10PM +0100, Helge Deller wrote:
> 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>
Looks good, and works on metag too!
Tested-by: James Hogan <james.hogan@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 084ed9f..71591f3 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2859,10 +2859,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);
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index f28f7fa..901f96c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -546,7 +546,7 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
>
> config DEBUG_STACK_USAGE
> bool "Stack utilization instrumentation"
> - depends on DEBUG_KERNEL && !IA64 && !PARISC && !METAG
> + depends on DEBUG_KERNEL && !IA64
> 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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-29 22:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-19 16:54 [PATCH] parisc,metag: Implement CONFIG_DEBUG_STACK_USAGE option Helge Deller
2016-03-19 16:54 ` Helge Deller
2016-04-29 22:04 ` James Hogan
2016-04-29 22:04 ` James Hogan
2016-04-29 22:04 ` James Hogan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.