From: Chao Yu <chao@kernel.org>
To: zhaoyuenan <amktiao030215@gmail.com>
Cc: chao@kernel.org, jaegeuk@kernel.org,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: Add ckpt_thread_task sysfs node
Date: Wed, 10 Jun 2026 20:09:04 +0800 [thread overview]
Message-ID: <db2ee7b6-acbb-4a2c-acc0-2d76ea510dc2@kernel.org> (raw)
In-Reply-To: <20260522135654.19535-1-amktiao030215@gmail.com>
Hi Yuenan,
On 5/22/26 21:56, zhaoyuenan wrote:
> Hi Chao,
>
> On 5/22/26 10:50, Chao Yu wrote:
>> Hi Yuenan,
>>
>> Thanks for your contribution!
>>
>> If there is a method to get pid via userspace, I prefer to do it in userspace,
>> rather than implementing and maintaining an duplicated one in kernel.
>>
>> Or do you have a strong reason to do this in kernel?
>
> The main reason is that retrieving this PID from userspace is currently
> quite complex and fragile.
>
> Previously, userspace tools had to rely on pipelines like:
> pgrep f2fs_ckpt-$(ls -l /dev/block/by-name/userdata | awk '{print $5$6}' | tr ',' ':')
>
> This approach has a few drawbacks:
> 1. It requires parsing major/minor numbers and executing multiple commands,
> which is inefficient for simple monitoring tools.
I don't see why there is any performance concern in your scenario.
> 2. On some older kernels, the thread name can be truncated due to TASK_COMM_LEN
> limitations, causing 'pgrep' to fail to match the full 'f2fs_ckpt-X:Y' string.
I don't think this method has scalability, is it better to backport below patch? so
that you can trace all kthreads and set them to target cgroup.
https://lore.kernel.org/all/20211120112850.46047-1-laoar.shao@gmail.com
Thanks,
>
> Exposing the PID via a sysfs node provides a deterministic, lightweight,
> and reliable way (just a simple 'cat') to fetch it without any userspace
> guessing or complex parsing.
>
> Does this address your concern?
>
> Thanks,
> Yuenan
prev parent reply other threads:[~2026-06-10 12:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260521151008.13682-1-amktiao030215@gmail.com>
2026-05-22 13:56 ` [PATCH] f2fs: Add ckpt_thread_task sysfs node zhaoyuenan
2026-06-10 12:09 ` Chao Yu [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=db2ee7b6-acbb-4a2c-acc0-2d76ea510dc2@kernel.org \
--to=chao@kernel.org \
--cc=amktiao030215@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.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