aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Siddle <jsiddle@redhat.com>2016-10-11 16:55:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-11 18:06:33 -0400
commit48a6d64edadbd40fa5185a890023e9b331d64a48 (patch)
treec17f8328ae55c248cb02d434ff57f355028aa3ca
parente154ccc831b5b52a9aa3fe881090bdaf1d80f062 (diff)
hung_task: allow hung_task_panic when hung_task_warnings is 0
Previously hung_task_panic would not be respected if enabled after hung_task_warnings had already been decremented to 0. Permit the kernel to panic if hung_task_panic is enabled after hung_task_warnings has already been decremented to 0 and another task hangs for hung_task_timeout_secs seconds. Check if hung_task_panic is enabled so we don't return prematurely, and check if hung_task_warnings is non-zero so we don't print the warning unnecessarily. [akpm@linux-foundation.org: fix off-by-one] Link: http://lkml.kernel.org/r/1473450214-4049-1-git-send-email-jsiddle@redhat.com Signed-off-by: John Siddle <jsiddle@redhat.com> Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/hung_task.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 432c3d71d195..2b59c82cc3e1 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -98,26 +98,26 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
98 98
99 trace_sched_process_hang(t); 99 trace_sched_process_hang(t);
100 100
101 if (!sysctl_hung_task_warnings) 101 if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic)
102 return; 102 return;
103 103
104 if (sysctl_hung_task_warnings > 0)
105 sysctl_hung_task_warnings--;
106
107 /* 104 /*
108 * Ok, the task did not get scheduled for more than 2 minutes, 105 * Ok, the task did not get scheduled for more than 2 minutes,
109 * complain: 106 * complain:
110 */ 107 */
111 pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n", 108 if (sysctl_hung_task_warnings) {
112 t->comm, t->pid, timeout); 109 sysctl_hung_task_warnings--;
113 pr_err(" %s %s %.*s\n", 110 pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
114 print_tainted(), init_utsname()->release, 111 t->comm, t->pid, timeout);
115 (int)strcspn(init_utsname()->version, " "), 112 pr_err(" %s %s %.*s\n",
116 init_utsname()->version); 113 print_tainted(), init_utsname()->release,
117 pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" 114 (int)strcspn(init_utsname()->version, " "),
118 " disables this message.\n"); 115 init_utsname()->version);
119 sched_show_task(t); 116 pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
120 debug_show_all_locks(); 117 " disables this message.\n");
118 sched_show_task(t);
119 debug_show_all_locks();
120 }
121 121
122 touch_nmi_watchdog(); 122 touch_nmi_watchdog();
123 123