stack usage: add pid to warning printk in check_stack_usage
authorTim Bird <[email protected]>
Thu, 31 May 2012 23:26:16 +0000 (16:26 -0700)
committerLinus Torvalds <[email protected]>
Fri, 1 Jun 2012 00:49:28 +0000 (17:49 -0700)
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 <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/exit.c

index 3281493ce7adfa1090800c9376081c43ed36cae2..6d85655353e919fd56e0d2cc65cb36862e328a8c 100644 (file)
@@ -884,9 +884,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);