From: Muchun Song <muchun.song@linux.dev>
To: Tejun Heo <tj@kernel.org>
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: Fri, 16 May 2025 12:44:19 +0800 [thread overview]
Message-ID: <8A1F225D-714C-427C-A0ED-1DE5D93DEAD1@linux.dev> (raw)
> On May 15, 2025, at 23:53, Tejun Heo <tj@kernel.org> wrote:
>
> Hello, Muchun.
>
> On Thu, May 15, 2025 at 12:05:23PM +0800, Muchun Song wrote:
>> Workqueues, such as system_unbound_wq, are shared across the system,
>> making it difficult to determine which tasks are being executed by
>> each worker. This patch improves clarity by displaying the latest
>> function name associated with each workqueue worker in the
>> /proc/PID/{comm,stat,status}. For example:
>>
>> Before:
>> # ps 64 67 68
>> PID TTY STAT TIME COMMAND
>> 64 ? I 0:00 [kworker/u34:0-events_unbound]
>> 67 ? I 0:00 [kworker/u33:1-events_unbound]
>> 68 ? I 0:00 [kworker/u33:2-events_unbound]
>>
>> After:
>> # ps 64 67 68
>> PID TTY STAT TIME COMMAND
>> 64 ? I 0:00 [kworker/u34:0-events_unbound:flush_memcg_stats_dwork]
>> 67 ? I 0:00 [kworker/u33:1-events_unbound:flush_to_ldisc]
>> 68 ? I 0:00 [kworker/u33:2-events_unbound:idle_cull_fn]
>>
>> This change provides a clearer view of the tasks being performed by
>> each worker, enhancing system monitoring and debugging.
>
> One worry I have about this is that these will likely be stale most of the
> time as kworkers are just sitting and waiting, and there's no connection
> between what a kworker ran before and what it's going to run next, so I'm
> unsure how useful the extra information is.
Hi Tejun,
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.
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.
Muchun,
Thanks
>
> Thanks.
>
> --
> tejun
next reply other threads:[~2025-05-16 4:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 4:44 Muchun Song [this message]
2025-05-19 20:07 ` Tejun Heo
-- 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=8A1F225D-714C-427C-A0ED-1DE5D93DEAD1@linux.dev \
--to=muchun.song@linux.dev \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=songmuchun@bytedance.com \
--cc=tj@kernel.org \
/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®