All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stack usage: Add pid to warning printk in check_stack_usage
@ 2012-04-11 17:19 Tim Bird
  2012-04-12 21:50 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Bird @ 2012-04-11 17:19 UTC (permalink / raw)
  To: Oleg Nesterov, Andrew Morton, Andrea Arcangeli,
	Frederic Weisbecker, linux kernel

In embedded systems, sometimes the same program (busybox)
is the cause of multiple warnings.  Outputting the pid
with the program name in the warning printk helps
distinguish which instances of a program are using
the stack most.

This is a small patch, but useful.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
---
 exit.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index b8a6a09..bad923d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -898,9 +898,9 @@ static void check_stack_usage(void)

 	spin_lock(&low_water_lock);
 	if (free < lowest_to_date) {
-		printk(KERN_WARNING "%s used greatest stack depth: %lu bytes "
-				"left\n",
-				current->comm, free);
+		printk(KERN_WARNING "%s (%d) used greatest stack depth: "
+				"%lu bytes left\n",
+				current->comm, task_pid_nr(current), free);
 		lowest_to_date = free;
 	}
 	spin_unlock(&low_water_lock);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] stack usage: Add pid to warning printk in check_stack_usage
  2012-04-11 17:19 [PATCH] stack usage: Add pid to warning printk in check_stack_usage Tim Bird
@ 2012-04-12 21:50 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2012-04-12 21:50 UTC (permalink / raw)
  To: Tim Bird
  Cc: Andrew Morton, Andrea Arcangeli, Frederic Weisbecker, linux kernel

On 04/11, Tim Bird wrote:
>
> In embedded systems, sometimes the same program (busybox)
> is the cause of multiple warnings.  Outputting the pid
> with the program name in the warning printk helps
> distinguish which instances of a program are using
> the stack most.
>
> This is a small patch, but useful.

Agreed, pid_nr alone is useless if you read the logs when this
app has already terminated.

> Signed-off-by: Tim Bird <tim.bird@am.sony.com>
> ---
>  exit.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/exit.c b/kernel/exit.c
> index b8a6a09..bad923d 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -898,9 +898,9 @@ static void check_stack_usage(void)
> 
>  	spin_lock(&low_water_lock);
>  	if (free < lowest_to_date) {
> -		printk(KERN_WARNING "%s used greatest stack depth: %lu bytes "
> -				"left\n",
> -				current->comm, free);
> +		printk(KERN_WARNING "%s (%d) used greatest stack depth: "
> +				"%lu bytes left\n",
> +				current->comm, task_pid_nr(current), free);
>  		lowest_to_date = free;
>  	}
>  	spin_unlock(&low_water_lock);
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-12 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 17:19 [PATCH] stack usage: Add pid to warning printk in check_stack_usage Tim Bird
2012-04-12 21:50 ` Oleg Nesterov

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.