From: Andrew Morton <akpm@linux-foundation.org>
To: Leon Hwang <leon.hwang@linux.dev>
Cc: Lance Yang <lance.yang@linux.dev>,
Masami Hiramatsu <mhiramat@kernel.org>,
Petr Mladek <pmladek@suse.com>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Feng Tang <feng.tang@linux.alibaba.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hung_task: avoid duplicate stack dumps in sys_info()
Date: Mon, 30 Nov 2026 16:50:41 -0800 [thread overview]
Message-ID: <20261130165041.323f372cd6435bcab0f13c0f@linux-foundation.org> (raw)
In-Reply-To: <20261130151156.22234-1-leon.hwang@linux.dev>
On Mon, 30 Nov 2026 23:11:56 +0800 Leon Hwang <leon.hwang@linux.dev> wrote:
> When hung_task_sys_info includes blocked_tasks, khungtaskd dumps each
> reported hung task's stack, then calls sys_info() to dump D-state tasks.
> A task that stays blocked gets its stack printed twice in the same scan.
>
> Track the tasks khungtaskd reports during the scan. If a recorded task
> still appears blocked at the same switch count, print a short message
> in place of the second stack dump.
>
> With this change, the second dump would be replaced with a log.
>
> [ 20.143549] INFO: task cat:607 blocked for more than 5 seconds.
> [ 20.143560] Not tainted 7.4.0-rc4-gfb22a6547753-dirty #12
> [ 20.143564] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 20.143567] task:cat state:D stack:0 pid:607 tgid:607 ppid:603 task_flags:0x400000 flags:0x00080000
>
> ...
>
> [ 20.144250] task cat:607 has been reported by hung task detector.
OK. This is a pretty minor bug! And userspace can filter out the
duplicates easily enough (I assume).
> ---
> include/linux/hung_task.h | 9 +++++
> kernel/hung_task.c | 76 ++++++++++++++++++++++++++++++++++++---
> kernel/sched/core.c | 4 +++
> 3 files changed, 85 insertions(+), 4 deletions(-)
And that's a lot of churn.
<idea>
task_struct.atomic_flags has plenty of unused bits and using one of
them for this purpose seems appropriate.
Can we set one of those bits for deduplication and later test-n-clear
it in
check_hung_uninterruptible_tasks()
->sys_info(si_mask)
->show_state_filter(TASK_UNINTERRUPTIBLE)?
Or something along these lines?
prev parent reply other threads:[~2026-12-01 0:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 15:11 Leon Hwang
2026-12-01 0:50 ` Andrew Morton [this message]
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=20261130165041.323f372cd6435bcab0f13c0f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=feng.tang@linux.alibaba.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=lance.yang@linux.dev \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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
all inboxes | Powered by JetHome®