Skip to contentSkip to conversation

hung_task: decrement sysctl_hung_task_warnings only if it is positive

PATCH New [email protected] 1 participant 1 message Dec 13, 2016 Hung task detector

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 100/123 hung_task: decrement sysctl_hung_task_warnings only if it is positive

From: Tetsuo Handa <[email protected]>
Subject: hung_task: decrement sysctl_hung_task_warnings only if it is positive

Since sysctl_hung_task_warnings == -1 is allowed (infinite warnings), 48a6d64edadbd40f ("hung_task: allow hung_task_panic when hung_task_warnings is 0") should decrement it only when it is not -1.

This prevents the kernel from ceasing warnings after the first 4294967295 ;)

---

 kernel/hung_task.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/hung_task.c renamed from kernel/hung_task.c~hung_task-decrement-sysctl_hung_task_warnings-only-if-it-is-positive +2 -1
diff -puN kernel/hung_task.c~hung_task-decrement-sysctl_hung_task_warnings-only-if-it-is-positive kernel/hung_task.c
@@ -106,7 +106,8 @@ static void check_hung_task(struct task_
 	 * complain:
 	 */
 	if (sysctl_hung_task_warnings) {
-		sysctl_hung_task_warnings--;
+		if (sysctl_hung_task_warnings > 0)
+			sysctl_hung_task_warnings--;
 		pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
 			t->comm, t->pid, timeout);
 		pr_err("      %s %s %.*s\n",

_