From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D1233FC5B7 for ; Wed, 10 Jun 2026 12:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781093349; cv=none; b=ixMnQeKHFi1SdkgrUfLpsPYzPB/NI9zay+AMZtP9DiQ4mcmgUQOd5R2q2YcZFIrHI0E4LVLUjOhOAAXLCkedcjCUMGWCzNLokKZ3TJy3gddlj3mbWe2PJjgMrtl4ueUvceNwKNkRetCpEBe2HjY3I97tBe/EaiiMAN6HsjeDtvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781093349; c=relaxed/simple; bh=z4mAYpmElvB9OFuJaW8faxqyZFerGwzh//CmAMKWItQ=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=ITglSW4CttmejtweH8mnRp4QVUmP1g6ZXVQw9M7RrjTE83miHRpLvk3P+DW4TN7fQzUy/EDyR3CWCM50HoIY55mw35eS/IZJbfeeVUKzKuNsHfmksPLF/iuZgsvuQUhLORoIorOyRAlRzguo/CypNu8gsZlswg5VPC0Nm1FVVnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C8S3G2tR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C8S3G2tR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C764B1F00893; Wed, 10 Jun 2026 12:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781093347; bh=bAZPdDg/rpOnaAuujF2rrlfIZrvDxsbfPGxXlX68OM0=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=C8S3G2tR0/QKC/VVUhTnPVuNVzW2gaYOFx5c7DDTl1YphUU99XT+AZz8r4VDtUTs5 4gNiUk10e4p7naY/iGmOHNUa81orWAfO7e6H6MIY1zZ+OgBj2vPhkni+VJtZFEsOwh Qx1J4tTfzOv8scZmgl2AYR8Apz6oT4jA9+VInG73SMslsvzlt892dvQ6S7x54+13JA 7Gsa4SsS3Nzlhp+9A22CmjY6I561lu//S1vIzdXAKke55GTTl94sKLEYzqz9GAhcjP pfP2mVQh+FjVzswWK3Af/rYOXHRImOKRWQid/jhMIJBqq/HaqIFrdGQ1P4u+1lUGTe XcRltr3mK2kHw== Message-ID: Date: Wed, 10 Jun 2026 20:09:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird 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 To: zhaoyuenan References: <20260521151008.13682-1-amktiao030215@gmail.com> <20260522135654.19535-1-amktiao030215@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260522135654.19535-1-amktiao030215@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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