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
9898
9999 trace_sched_process_hang(t);
100100
101− if (!sysctl_hung_task_warnings)
101+ if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic)
102102 return;
103103
104− if (sysctl_hung_task_warnings > 0)
105− sysctl_hung_task_warnings--;
106−
107104 /*
108105 * Ok, the task did not get scheduled for more than 2 minutes,
109106 * complain:
110107 */
111− pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
112− t->comm, t->pid, timeout);
113− pr_err(" %s %s %.*s\n",
114− print_tainted(), init_utsname()->release,
115− (int)strcspn(init_utsname()->version, " "),
116− init_utsname()->version);
117− pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
118− " disables this message.\n");
119− sched_show_task(t);
120− debug_show_all_locks();
108+ if (sysctl_hung_task_warnings) {
109+ sysctl_hung_task_warnings--;
110+ pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
111+ t->comm, t->pid, timeout);
112+ pr_err(" %s %s %.*s\n",
113+ print_tainted(), init_utsname()->release,
114+ (int)strcspn(init_utsname()->version, " "),
115+ init_utsname()->version);
116+ pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
117+ " disables this message.\n");
118+ sched_show_task(t);
119+ debug_show_all_locks();
120+ }
121121
122122 touch_nmi_watchdog();
123123