mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [f2fs-dev] [PATCH] f2fs: add checkpoint step timing statistics to debugfs
       [not found] ` <b2253246-48ba-4c48-899c-9f568fa2df71@kernel.org>
@ 2026-11-16 11:42   ` huangzheng
  0 siblings, 0 replies; only message in thread
From: huangzheng @ 2026-11-16 11:42 UTC (permalink / raw)
  To: Chao Yu, huang zheng, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel

在 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-16 11:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20261103091215.180531-1-huangzheng9869@gmail.com>
     [not found] ` <b2253246-48ba-4c48-899c-9f568fa2df71@kernel.org>
2026-11-16 11:42   ` [f2fs-dev] [PATCH] f2fs: add checkpoint step timing statistics to debugfs huangzheng

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®