Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48a6d64e authored by John Siddle's avatar John Siddle Committed by Linus Torvalds
Browse files

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: default avatarJohn Siddle <jsiddle@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e154ccc8
Loading
Loading
Loading
Loading
+14 −14
Original line number Original line Diff line number Diff line
@@ -98,16 +98,15 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)


	trace_sched_process_hang(t);
	trace_sched_process_hang(t);


	if (!sysctl_hung_task_warnings)
	if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic)
		return;
		return;


	if (sysctl_hung_task_warnings > 0)
		sysctl_hung_task_warnings--;

	/*
	/*
	 * Ok, the task did not get scheduled for more than 2 minutes,
	 * Ok, the task did not get scheduled for more than 2 minutes,
	 * complain:
	 * complain:
	 */
	 */
	if (sysctl_hung_task_warnings) {
		sysctl_hung_task_warnings--;
		pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
		pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
			t->comm, t->pid, timeout);
			t->comm, t->pid, timeout);
		pr_err("      %s %s %.*s\n",
		pr_err("      %s %s %.*s\n",
@@ -118,6 +117,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
			" disables this message.\n");
			" disables this message.\n");
		sched_show_task(t);
		sched_show_task(t);
		debug_show_all_locks();
		debug_show_all_locks();
	}


	touch_nmi_watchdog();
	touch_nmi_watchdog();