From: Petr Mladek <pmladek@suse.com>
To: Aaron Tomlin <atomlin@atomlin.com>
Cc: Lance Yang <lance.yang@linux.dev>,
neelx@suse.com, sean@ashe.io, mhiramat@kernel.org,
akpm@linux-foundation.org, joel.granados@kernel.org,
mproche@gmail.com, chjohnst@gmail.com, nick.lange@gmail.com,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hung_task: Skip scan on idle systems
Date: Mon, 2 Feb 2026 14:55:41 +0100 [thread overview]
Message-ID: <aYCs3VNtxccjarXi@pathway> (raw)
In-Reply-To: <3pafybrou47nar5l2xxqjvmbhupmsxr4vvawhdadd5qeyhu3sf@mmugthbxe2cs>
On Mon 2026-01-26 15:14:27, Aaron Tomlin wrote:
> On Mon, Jan 26, 2026 at 01:23:01PM +0800, Lance Yang wrote:
> > Hi Aaron,
>
> Hi Lance,
>
> > Keep one patch or series under review at a time, especially in the
> > same subsystem ...
+1 :-)
> Understood. That's fair.
>
> > > @@ -503,6 +504,7 @@ static int watchdog(void *dummy)
> > > for ( ; ; ) {
> > > unsigned long timeout = sysctl_hung_task_timeout_secs;
> > > unsigned long interval = sysctl_hung_task_check_interval_secs;
> > > + unsigned long load[3];
> > > long t;
> > > if (interval == 0)
> > > @@ -511,8 +513,12 @@ static int watchdog(void *dummy)
> > > t = hung_timeout_jiffies(hung_last_checked, interval);
> > > if (t <= 0) {
> > > if (!atomic_xchg(&reset_hung_task, 0) &&
> > > - !hung_detector_suspended)
> > > - check_hung_uninterruptible_tasks(timeout);
> > > + !hung_detector_suspended) {
> > > + /* Check 1-min load to detect idle system */
> > > + get_avenrun(load, 0, 0);
> > > + if (load[0] > 0)
> > > + check_hung_uninterruptible_tasks(timeout);
> >
> > The optimization is not worth the trouble.
> >
> > I don't think the assumption that "load[0] == 0 means no hung tasks" is
> > 100% correct.
> >
> > So that would miss actual hung tasks - a false negative, which is worse
> > than the "wasted scan" you're trying to avoid.
> >
> > Also, I don't *really* care about optimizing something that runs once
> > every 120 seconds :)
> >
> > Nacked-by: Lance Yang <lance.yang@linux.dev>
>
> Yes, please ignore. This is indeed wrong.
>
> Regarding the value of the optimisation, while a 120-second interval
> implies a low frequency, the cost of the scan is O(N). On large servers
> with high thread counts (even if idle), iterating the entire task list
> dirties cache lines and consumes memory bandwidth unnecessarily.
>
> Nevertheless, we currently do not have a way to economically compute the
> total number of tasks in TASK_UNINTERRUPTIBLE state.
It makes some sense. And the check of the average load is trivial
so it might be acceptable.
But I somehow doubt that it works. Have you ever seen a system with
(avenrun[0] == 0)? IMHO, it might be pretty hard to achieve it.
Or maybe I am too pessimistic. Or are there embedded systems which can
only be waken by some interrupt from a sensor? Do embedded systems
run hung task detector?
By other words. Is this patch solving a theoretical scenario?
Did you test it in practice, please?
Best Regards,
Petr
next prev parent reply other threads:[~2026-02-02 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 3:45 [PATCH] hung_task: Skip scan on idle systems Aaron Tomlin
2026-01-26 5:23 ` Lance Yang
2026-01-26 20:14 ` Aaron Tomlin
2026-02-02 13:55 ` Petr Mladek [this message]
2026-02-07 21:01 ` Aaron Tomlin
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=aYCs3VNtxccjarXi@pathway \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=chjohnst@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joel.granados@kernel.org \
--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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.