public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <andrea@suse.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] stack usage: Add pid to warning printk in check_stack_usage
Date: Wed, 11 Apr 2012 10:19:00 -0700	[thread overview]
Message-ID: <4F85BD04.3070407@am.sony.com> (raw)

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);


             reply	other threads:[~2012-04-11 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 17:19 Tim Bird [this message]
2012-04-12 21:50 ` [PATCH] stack usage: Add pid to warning printk in check_stack_usage Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F85BD04.3070407@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrea@suse.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox