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

From: Petr Mladek

Date: Wed Aug 26 2026 - 07:35:40 EST


On Sat 2026-08-15 00:27:34, Lance Yang wrote:
>
> On Fri, Aug 14, 2026 at 09:57:18AM -0400, Aaron Tomlin wrote:
> >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.
>
> Hm... not quite unconditional. hung_task_call_panic still gets through
> budget gate, so with hung_task_warnings=1 and hung_task_panic=2, first
> task can exhaust budget and second one still gets full details (right
> before panic).

Great catch!

> I'd write changelog like this:
>
> Once the warning budget is exhausted, hung_task_info() normally stops
> printing per-task details. When panic is triggered, full details are
> still printed so diagnostics remain available before panic.
>
> To retain visibility without restoring per-task output after budget
> exhaustion, emit a single aggregate summary line at the end of each
> watchdog scan that detects hung tasks with an exhausted budget. This
> keeps non-panic per-task reports budgeted during system-wide hangs.

Yup, this sounds better.

> >--- 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");
>
> Same exception here... next task can hit panic threshold and print full
> details anyway (and this line can be printed while hung_task_call_panic
> is already set).
>
> I'd make condition and message match actual behavior:
>
> "hung_task: further per-task details suppressed until warning budget is
> reset or panic is triggered (see sysctl kernel.hung_task_warnings)\n"

Looks better as well.

With the two changes:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

One more idea. It might be useful to print a message also
in first clean check after a stall was resolved.

But it might need to add one more variable, e.g.
last_round_count. We could not check
(hung_task_warnings_printed != READ_ONCE(sysctl_hung_task_warnings))
because it might be racy.

It might be done later in a separate patch.

Best Regards,
Petr