From: Tejun Heo <tj@kernel.org>
To: Muchun Song <muchun.song@linux.dev>
Cc: Muchun Song <songmuchun@bytedance.com>,
jiangshanlai@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: show the latest function name in /proc/PID/{comm,stat,status}
Date: Mon, 19 May 2025 10:07:17 -1000 [thread overview]
Message-ID: <aCuPdY2fbOIOoKx6@slm.duckdns.org> (raw)
In-Reply-To: <8A1F225D-714C-427C-A0ED-1DE5D93DEAD1@linux.dev>
Hello,
On Fri, May 16, 2025 at 12:44:19PM +0800, Muchun Song wrote:
...
> Monitoring tools like atop can indeed record comm of processes. When we
> encounter issues such as high CPU usage, these tools can help us identify
> the problem. For instance, if kworkers are consuming most of the CPU, we
> can use this information to pinpoint which specific function is using
> the most CPU.
You can get more detailed information with `cat /proc/KWORKER_PID/stack`.
The problem is that last_func can be stale most of the time and can be more
misleading than useful.
> Another use case is when we use the isolcpus= command line option
> to isolate CPUs, we want to make sure that no kworker threads run on
> those CPUs. But sometimes, kworkers might still get scheduled there, causing latency
> issues. By using this information, we can figure out which module's
> function ran on the CPU before and then dig into the code to see how to
> stop it from happening.
Can you explain why `cat /proc/KWORKER_PID/stack` can't be used for that? If
the worker runtime is too short to capture, you can easily use tracepoints
or bpftrace too. What are the benefits of showing last_func?
Thanks.
--
tejun
next prev parent reply other threads:[~2025-05-19 20:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 4:44 [PATCH] workqueue: show the latest function name in /proc/PID/{comm,stat,status} Muchun Song
2025-05-19 20:07 ` Tejun Heo [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-05-15 4:05 Muchun Song
2025-05-15 15:53 ` Tejun Heo
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=aCuPdY2fbOIOoKx6@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=songmuchun@bytedance.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