]> git.ipfire.org Git - thirdparty/linux.git/commit
hung_task: increment the global counter immediately
authorPetr Mladek <pmladek@suse.com>
Tue, 3 Mar 2026 20:30:31 +0000 (15:30 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:40 +0000 (21:19 -0700)
commit5eaef7f8ee40150cbd78a7b445001929bb2d2031
tree311c5cce3591f61afe6e0308bcf8b03bd0c60e21
parent49085e1b70f898695b63594ff559f5a243589b83
hung_task: increment the global counter immediately

A recent change allowed to reset the global counter of hung tasks using
the sysctl interface.  A potential race with the regular check has been
solved by updating the global counter only once at the end of the check.

However, the hung task check can take a significant amount of time,
particularly when task information is being dumped to slow serial
consoles.  Some users monitor this global counter to trigger immediate
migration of critical containers.  Delaying the increment until the full
check completes postpones these high-priority rescue operations.

Update the global counter as soon as a hung task is detected.  Since the
value is read asynchronously, a relaxed atomic operation is sufficient.

Link: https://lkml.kernel.org/r/20260303203031.4097316-4-atomlin@atomlin.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
Reported-by: Lance Yang <lance.yang@linux.dev>
Closes: https://lore.kernel.org/r/f239e00f-4282-408d-b172-0f9885f4b01b@linux.dev
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joel Granados <joel.granados@kernel.org>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/hung_task.c