Re: [PATCH v9 1/2] hung_task: Reset warning budget when problem gets resolved

From: Aaron Tomlin

Date: Fri Aug 14 2026 - 13:22:56 EST


On Fri, Aug 14, 2026 at 11:58:21PM +0800, Lance Yang wrote:
>
> On Fri, Aug 14, 2026 at 09:57:17AM -0400, Aaron Tomlin wrote:
> >The sysctl hung_task_warnings currently holds both the configured warning
> >limit and the remaining budget. Each detailed report decrements the
> >sysctl, so once it reaches zero, the configured limit is lost and cannot
> >be restored automatically.
> >
> >Keep sysctl hung_task_warnings unchanged and track the remaining budget
> >in hung_task_warnings_printed. Reset the runtime budget via an atomic flag
> >when a watchdog check sees no hung tasks or when userspace writes a new
> >sysctl value.
>
> Only sysctl writes go through reset_hung_task_warnings; no-hung case
> reloads budget directly. Also worth spelling out why flag is there:
> keeping runtime budget khungtaskd-owned. I'd write it as:
>
> Keep sysctl_hung_task_warnings as the configured warning limit and make
> khungtaskd the sole owner of the remaining budget. A check that finds no
> hung tasks reloads the budget directly from the configured limit. A
> successful sysctl write publishes an atomic reset request, which
> khungtaskd consumes at the start of the next check.
>
> No need to resend just for this, though. I think Andrew can fix that up
> when applying.

Hi Lance,

Acknowledged.

> >Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
> >Suggested-by: Lance Yang <lance.yang@xxxxxxxxx>
> >Tested-by: Lance Yang <lance.yang@xxxxxxxxx>
> >Signed-off-by: Aaron Tomlin <atomlin@xxxxxxxxxxx>
> >---
>
> Nothing jumped out at me, thanks!
>
> Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>

Thank you!

--
Aaron Tomlin