Commit 41e85ce8220c6e5fdef706fda6696cd291115b63

Authored by Oleg Nesterov
Committed by Ingo Molnar
1 parent 2b48839722

hung_task debugging: Print more info when reporting the problem

printk(KERN_ERR) from check_hung_task() likely means we have a bug,
but unlike BUG_ON()/WARN_ON ()it doesn't show the kernel version,
this complicates the bug-reports investigation.

Add the additional pr_err() to print tainted/release/version
like dump_stack_print_info() does, the output becomes:

        INFO: task perl:504 blocked for more than 2 seconds.
	      Not tainted 3.11.0-rc1-10367-g136bb46-dirty #1763
        "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        ...

While at it, turn the old printk's into pr_err().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: ahecox@redhat.com
Cc: Christopher Williams <cww@redhat.com>
Cc: dwysocha@redhat.com
Cc: gavin@redhat.com
Cc: Mandeep Singh Baines <msb@chromium.org>
Cc: nshi@redhat.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20130801165941.GA17544@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

Showing 1 changed file with 9 additions and 4 deletions Side-by-side Diff

... ... @@ -15,6 +15,7 @@
15 15 #include <linux/lockdep.h>
16 16 #include <linux/export.h>
17 17 #include <linux/sysctl.h>
  18 +#include <linux/utsname.h>
18 19  
19 20 /*
20 21 * The number of tasks checked:
... ... @@ -99,10 +100,14 @@
99 100 * Ok, the task did not get scheduled for more than 2 minutes,
100 101 * complain:
101 102 */
102   - printk(KERN_ERR "INFO: task %s:%d blocked for more than "
103   - "%ld seconds.\n", t->comm, t->pid, timeout);
104   - printk(KERN_ERR "\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
105   - " disables this message.\n");
  103 + pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
  104 + t->comm, t->pid, timeout);
  105 + pr_err(" %s %s %.*s\n",
  106 + print_tainted(), init_utsname()->release,
  107 + (int)strcspn(init_utsname()->version, " "),
  108 + init_utsname()->version);
  109 + pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
  110 + " disables this message.\n");
106 111 sched_show_task(t);
107 112 debug_show_held_locks(t);
108 113