mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: huangzheng <huangz6756@gmail.com>
To: Chao Yu <chao@kernel.org>, huang zheng <huangzheng9869@gmail.com>,
	jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH] f2fs: add checkpoint step timing statistics to debugfs
Date: Mon, 16 Nov 2026 19:42:50 +0800	[thread overview]
Message-ID: <d9ba27e6-45f8-47a4-b0bc-c9ccdbfd3c14@xiaomi.com> (raw)
In-Reply-To: <b2253246-48ba-4c48-899c-9f568fa2df71@kernel.org>

在 2026/11/11 16:19, Chao Yu via Linux-f2fs-devel 写道:
> On 11/3/26 17:12, huang zheng wrote:
>> From: Huang Zheng <huangzheng9869@gmail.com>
>>
>> This patch adds detailed timing statistics for each checkpoint step
>> to the debugfs stat_show interface. It displays the time taken by
>> each phase of the checkpoint process, including:
>>
>> - lock acquisition
>> - block operations
>> - flushing data/node/meta pages
>> - flushing NAT/SIT
>> - syncing metadata
>> - waiting for dirty meta/checkpoint data
>> - device flushing
>> - waiting for last checkpoint
> 
> Well, all spot times should be consistent only after checkpoint(), if stat_show()
> captures times during checkpoint, the times could be inconsistent.
Fix by v2 patch>
>>
>> This information is valuable for debugging checkpoint performance
>> issues and identifying which steps are taking the most time during
>> the checkpoint process.
>>
>> The statistics show the longest recorded time for each step, helping
> 
> It didn't, it record the time every time, but only printing the stats in
> kmsg if the total time exceeds the threshold (5sec).
I want to check `cat /sys/kernel/debug/f2fs/status` to get the longest 
time and see the elapsed time of each step, as follow:
CP steps (longest):
   - Total : 524(ms)
   - lock : 0(ms)
   - block_operation : 13(ms)
   - flush_data_node_meta : 0(ms)
   - flush_nat : 93(ms)
   - flush_sit : 56(ms)
   - sync_meta : 32(ms)
   - sync_cp_meta : 0(ms)
   - wait_dirty_meta : 0(ms)
   - wait_cp_data : 0(ms)
   - flush_device : 0(ms)
   - wait_last_cp : 0(ms)
   - unblock_operation : 327(ms)

> 
> Thanks,
> 
>> developers and users understand where checkpoint bottlenecks occur.
>>
>> Signed-off-by: Huang Zheng <huangzheng1@xiaomi.com>
>> ---
>>   fs/f2fs/debug.c | 24 ++++++++++++++++++++++++
>>   1 file changed, 24 insertions(+)
>>
>> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
>> index 6fe606e2c70d..8fd76a69dcad 100644
>> --- a/fs/f2fs/debug.c
>> +++ b/fs/f2fs/debug.c
>> @@ -445,6 +445,22 @@ static const char *ipu_mode_names[F2FS_IPU_MAX] = {
>>   	[F2FS_IPU_HONOR_OPU_WRITE]	= "HONOR_OPU_WRITE",
>>   };
>>   
>> +static const char *cp_time_names[CP_TIME_MAX] = {
>> +	[CP_TIME_START]		= "begin",
>> +	[CP_TIME_LOCK]		= "lock",
>> +	[CP_TIME_OP_LOCK]	= "block_operation",
>> +	[CP_TIME_MERGE_WRITE]	= "flush_data_node_meta",
>> +	[CP_TIME_FLUSH_NAT]	= "flush_nat",
>> +	[CP_TIME_FLUSH_SIT]	= "flush_sit",
>> +	[CP_TIME_SYNC_META]	= "sync_meta",
>> +	[CP_TIME_SYNC_CP_META]	= "sync_cp_meta",
>> +	[CP_TIME_WAIT_DIRTY_META] = "wait_dirty_meta",
>> +	[CP_TIME_WAIT_CP_DATA]	= "wait_cp_data",
>> +	[CP_TIME_FLUSH_DEVICE]	= "flush_device",
>> +	[CP_TIME_WAIT_LAST_CP]	= "wait_last_cp",
>> +	[CP_TIME_END]		= "unblock_operation",
>> +};
>> +
>>   static int stat_show(struct seq_file *s, void *v)
>>   {
>>   	struct f2fs_stat_info *si;
>> @@ -631,6 +647,14 @@ static int stat_show(struct seq_file *s, void *v)
>>   		seq_printf(s, "  - Total : %4d\n", si->nr_total_ckpt);
>>   		seq_printf(s, "  - Cur time : %4d(ms)\n", si->cur_ckpt_time);
>>   		seq_printf(s, "  - Peak time : %4d(ms)\n", si->peak_ckpt_time);
>> +		seq_puts(s, "CP steps (longest):\n");
>> +		seq_printf(s, "  - Total : %llu(ms)\n",
>> +			   (u64)ktime_ms_delta(sbi->cp_stats.times[CP_TIME_END],
>> +					sbi->cp_stats.times[CP_TIME_START]));
>> +		for (j = 0; j < CP_TIME_MAX - 1; j++)
>> +			seq_printf(s, "  - %s : %llu(ms)\n", cp_time_names[j + 1],
>> +				   (u64)ktime_ms_delta(sbi->cp_stats.times[j + 1],
>> +					sbi->cp_stats.times[j]));
>>   		seq_printf(s, "GC calls: %d (gc_thread: %d)\n",
>>   			   si->gc_call_count[BACKGROUND] +
>>   			   si->gc_call_count[FOREGROUND],
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


           reply	other threads:[~2026-11-16 11:42 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <b2253246-48ba-4c48-899c-9f568fa2df71@kernel.org>]

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=d9ba27e6-45f8-47a4-b0bc-c9ccdbfd3c14@xiaomi.com \
    --to=huangz6756@gmail.com \
    --cc=chao@kernel.org \
    --cc=huangzheng9869@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

all inboxes | Powered by JetHome®