From: Petr Mladek <pmladek@suse.com>
To: Aaron Tomlin <atomlin@atomlin.com>
Cc: Lance Yang <lance.yang@linux.dev>,
akpm@linux-foundation.org, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, david.laight.linux@gmail.com,
neelx@suse.com, sean@ashe.io, chjohnst@gmail.com, steve@abita.co,
mproche@gmail.com, nick.lange@gmail.com
Subject: Re: [PATCH v4] hung_task: Deduplicate identical hang reports using explicit blocker tracking
Date: Thu, 2 Jul 2026 15:19:18 +0200 [thread overview]
Message-ID: <akZlVgbImH6Jqy55@pathway.suse.cz> (raw)
In-Reply-To: <lqupk44iejwf4potsyrsi4exel5ruhsjzzzrrbcx3xru5o7jbf@uk2dw5vkdcub>
On Sun 2026-06-28 16:56:39, Aaron Tomlin wrote:
> On Sun, Jun 28, 2026 at 12:47:50PM +0800, Lance Yang wrote:
> To step back and address your question directly regarding the real-world
> problem this patch aims to solve:
Thanks a lot for slowing down. It allows people to think more about
the problem and get feedback from more poeple. And it reduces the risk
of burn out of maintainers and reviewers.
> In large-scale, multi-tenant, production environments, lock contention is a
> frequent reality. When a core resource (e.g., a heavily contended rwsem or
> mutex) blocks, it does not just hang one task; it causes a cascading
> failure that halts hundreds of tasks simultaneously.
>
> When khungtaskd runs its scan during such an outage, it often reports
> identical stack traces into the kernel ring buffer, which is not entirely
> useful.
>
> The global sysctl_hung_task_warnings budget is instantly exhausted by a
> single lock storm. Consequently, the kernel is left entirely blind to
> subsequent, completely unrelated deadlocks occurring elsewhere in the
> system hours later.
>
> The changes introduced to date, moving away from the heuristic wchan
> approach to a more deterministic t->blocker tracking as per Petr's
> feedback, were an attempt to solve this without introducing complex
> heuristics or dangerous blind spots.
I would split this into two problems:
1. A single lock contention might trigger hung_report for many tasks
waiting for the same lock. It bloats the kernel log and messages
might even get lost.
2. The number of printed backtraces can be reduced by a global limit.
But the limit silences the hung task detector and system
administrators are blind once the limit is reached.
IMHO, the global limit "sysctl_hung_task_warnings" has been introduced
because of the 1st problem but it caused the 2nd problem.
My proposal:
------------
a) We could Change the semantic of "sysctl_hung_task_warnings". It could newly
limit the number of printed backtraces in a single hung-system
situations. I mean to reset it when the check_hung_uninterruptible_tasks()
does not detect any blocked tasks.
We could even print a message in this case. Something like:
if (atomic_long_read(&sysctl_hung_task_detect_count) && !this_round_count) {
pr_err("INFO: Tasks are not blocked by sleeping locks any longer.\n");
atomic_long_set(&sysctl_hung_task_detect_count, 0);
}
This would keep it working for 1st problem and solve the 2nd problem.
b) I like the check of task->blocker when it is available. But it
depends on CONFIG_DETECT_HUNG_TASK_BLOCKER. Also the hash array
looks like an overkill to me.
I would replace the hash array with a simple array[10]. It
should be enough in practice. Also it would be much easier
to clear it when the hung situation has gone.
That said, I am not sure if it is worth it.
c) Also storing the info about printed backtraces into struct
task_struct is interesting idea.
But again, I am not sure if it is worth it.
My opinion:
-----------
I would start with a). It is trivial. It solves the regression caused
by the current global limit. And the message about that
the hung-situation has been resolved is useful. So it
looks like win-win solution.
I would do b) and/or c) only when a) is not enough in practice.
That said:
----------
IMHO, CONFIG_DETECT_HUNG_TASK_BLOCKER is a rather cheap feature.
I believe that the overhead is small especially when we are
talking about sleeping locks. It is even enabled by default.
Adding the filtering by the blocker might be more effective
in practice than the "sysctl_hung_task_warnings" global
limit.
Best Regards,
Petr
next prev parent reply other threads:[~2026-07-02 13:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 20:57 [PATCH v4] hung_task: Deduplicate identical hang reports using explicit blocker tracking Aaron Tomlin
2026-06-28 4:47 ` Lance Yang
2026-06-28 20:56 ` Aaron Tomlin
2026-07-02 13:19 ` Petr Mladek [this message]
2026-07-04 21:35 ` Aaron Tomlin
2026-07-07 12:43 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=akZlVgbImH6Jqy55@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=chjohnst@gmail.com \
--cc=david.laight.linux@gmail.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mproche@gmail.com \
--cc=neelx@suse.com \
--cc=nick.lange@gmail.com \
--cc=sean@ashe.io \
--cc=steve@abita.co \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox