[PATCH v9 2/2] hung_task: Log summary line when warning budget is exhausted

Aaron Tomlin <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Once the warning budget is exhausted, hung_task_info() stops printing
per-task details. To provide visibility without causing additional log
spam, emit a single aggregate summary line at the end of each watchdog
scan when hung tasks are detected and the warning budget is exhausted.

Keep per-task reports budgeted to avoid flooding dmesg or causing
ring buffer overflows during system-wide hangs.

Suggested-by: Petr Mladek <[email protected]>
Suggested-by: Lance Yang <[email protected]>
Signed-off-by: Aaron Tomlin <[email protected]>
---
 kernel/hung_task.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 53499fbead83..f5eb75325f3a 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -268,7 +268,7 @@ static void hung_task_info(struct task_struct *t, unsigned long timeout,
 		debug_show_blocker(t, timeout);
 
 		if (!hung_task_warnings_printed)
-			pr_info("Future hung task reports are suppressed, see sysctl kernel.hung_task_warnings\n");
+			pr_info("Future hung task reports won't print details about each process, see sysctl kernel.hung_task_warnings\n");
 	}
 
 	touch_nmi_watchdog();
@@ -354,6 +354,10 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 		return;
 	}
 
+	if (!hung_task_warnings_printed && !hung_task_call_panic)
+		pr_info("hung_task: %lu hung tasks detected, warning budget exhausted\n",
+			this_round_count);
+
 	if (need_warning || hung_task_call_panic) {
 		si_mask |= SYS_INFO_LOCKS;
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.