History

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>

John Siddle committed 10 years ago

Commit 48a6d641 parent e154ccc1 file · +14 −14Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/hung_task.c+14−14
@@ -98,26 +98,26 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) · 97 unmodified lines
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