All of lore.kernel.org
 help / color / mirror / Atom feed
From: He YunLei <heyunlei@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 2/3] f2fs: add a tracepoint for background gc
Date: Sat, 10 Oct 2015 15:08:26 +0800	[thread overview]
Message-ID: <5618B96A.50205@huawei.com> (raw)
In-Reply-To: <1444085040-12843-2-git-send-email-jaegeuk@kernel.org>

On 2015/10/6 6:43, Jaegeuk Kim wrote:
> This patch introduces a tracepoint to monitor background gc behaviors.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/gc.c                |  3 +++
>   include/trace/events/f2fs.h | 28 ++++++++++++++++++++++++++++
>   2 files changed, 31 insertions(+)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index e627c19..e7cec86 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -77,6 +77,9 @@ static int gc_thread_func(void *data)
>
>   		stat_inc_bggc_count(sbi);
>
> +		trace_f2fs_background_gc(sbi->sb, wait_ms,
> +				prefree_segments(sbi), free_segments(sbi));
> +
>   		/* if return value is not zero, no victim was selected */
>   		if (f2fs_gc(sbi, test_opt(sbi, FORCE_FG_GC)))
>   			wait_ms = gc_th->no_gc_sleep_time;
> diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
> index 6aa63d9..7de751d 100644
> --- a/include/trace/events/f2fs.h
> +++ b/include/trace/events/f2fs.h
> @@ -514,6 +514,34 @@ TRACE_EVENT(f2fs_map_blocks,
>   		__entry->ret)
>   );
>
> +TRACE_EVENT(f2fs_background_gc,
> +
> +	TP_PROTO(struct super_block *sb, long wait_ms,
> +			unsigned int prefree, unsigned int free),
> +
> +	TP_ARGS(sb, wait_ms, prefree, free),
> +
> +	TP_STRUCT__entry(
> +		__field(dev_t,	dev)
> +		__field(long,	wait_ms)
> +		__field(unsigned int,	prefree)
> +		__field(unsigned int,	free)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev		= sb->s_dev;
> +		__entry->wait_ms	= wait_ms;
> +		__entry->prefree	= prefree;
> +		__entry->free		= free;
> +	),
> +
> +	TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
> +		show_dev(__entry),
> +		__entry->wait_ms,
> +		__entry->prefree,
> +		__entry->free)
> +);
> +
hi,
     I open f2fs_background_gc and f2fs_get_victim trace points, first, the partition has no dirty segment, so no victim is
selected, wait_ms is equal to 300s.

     f2fs_gc-8:33-2827  [001] ....  5014.608396: f2fs_background_gc: dev = (8,33), wait_ms = 300000, prefree = 0, free = 73
     f2fs_gc-8:33-2827  [000] ....  5314.793436: f2fs_background_gc: dev = (8,33), wait_ms = 300000, prefree = 0, free = 73

     then I made the partition satisfied the condition of has_enough_invalid_blocks, gc can get a victim and do garbage collection, wait_ms = 30s

     f2fs_gc-8:33-2827  [001] ....  5614.978486: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [001] ....  5614.978538: f2fs_get_victim: dev = (8,33), type = No TYPE, policy = (Background GC, LFS-mode, Cost-Benefit), victim = 441 ofs_unit = 1, pre_victim_secno = -1, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [000] ....  5644.996989: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [000] ....  5644.997027: f2fs_get_victim: dev = (8,33), type = No TYPE, policy = (Background GC, LFS-mode, Cost-Benefit), victim = 97 ofs_unit = 1, pre_victim_secno = -1, prefree = 0, free = 54

     when there no dirty segments left, I think wait_ms could turn back to 300s

     f2fs_gc-8:33-2827  [000] ....  6305.596205: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 1, free = 64
     f2fs_gc-8:33-2827  [001] ....  6605.781281: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
     f2fs_gc-8:33-2827  [000] ....  6905.966301: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
     f2fs_gc-8:33-2827  [001] ....  7206.151344: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
	
     here, background gc triggers every 300s, but wait_ms is still 30s, I don't know why?

Best wishes,
Thanks
>   TRACE_EVENT(f2fs_get_victim,
>
>   	TP_PROTO(struct super_block *sb, int type, int gc_type,
>


------------------------------------------------------------------------------

WARNING: multiple messages have this Message-ID (diff)
From: He YunLei <heyunlei@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs: add a tracepoint for background gc
Date: Sat, 10 Oct 2015 15:08:26 +0800	[thread overview]
Message-ID: <5618B96A.50205@huawei.com> (raw)
In-Reply-To: <1444085040-12843-2-git-send-email-jaegeuk@kernel.org>

On 2015/10/6 6:43, Jaegeuk Kim wrote:
> This patch introduces a tracepoint to monitor background gc behaviors.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/gc.c                |  3 +++
>   include/trace/events/f2fs.h | 28 ++++++++++++++++++++++++++++
>   2 files changed, 31 insertions(+)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index e627c19..e7cec86 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -77,6 +77,9 @@ static int gc_thread_func(void *data)
>
>   		stat_inc_bggc_count(sbi);
>
> +		trace_f2fs_background_gc(sbi->sb, wait_ms,
> +				prefree_segments(sbi), free_segments(sbi));
> +
>   		/* if return value is not zero, no victim was selected */
>   		if (f2fs_gc(sbi, test_opt(sbi, FORCE_FG_GC)))
>   			wait_ms = gc_th->no_gc_sleep_time;
> diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
> index 6aa63d9..7de751d 100644
> --- a/include/trace/events/f2fs.h
> +++ b/include/trace/events/f2fs.h
> @@ -514,6 +514,34 @@ TRACE_EVENT(f2fs_map_blocks,
>   		__entry->ret)
>   );
>
> +TRACE_EVENT(f2fs_background_gc,
> +
> +	TP_PROTO(struct super_block *sb, long wait_ms,
> +			unsigned int prefree, unsigned int free),
> +
> +	TP_ARGS(sb, wait_ms, prefree, free),
> +
> +	TP_STRUCT__entry(
> +		__field(dev_t,	dev)
> +		__field(long,	wait_ms)
> +		__field(unsigned int,	prefree)
> +		__field(unsigned int,	free)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev		= sb->s_dev;
> +		__entry->wait_ms	= wait_ms;
> +		__entry->prefree	= prefree;
> +		__entry->free		= free;
> +	),
> +
> +	TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
> +		show_dev(__entry),
> +		__entry->wait_ms,
> +		__entry->prefree,
> +		__entry->free)
> +);
> +
hi,
     I open f2fs_background_gc and f2fs_get_victim trace points, first, the partition has no dirty segment, so no victim is
selected, wait_ms is equal to 300s.

     f2fs_gc-8:33-2827  [001] ....  5014.608396: f2fs_background_gc: dev = (8,33), wait_ms = 300000, prefree = 0, free = 73
     f2fs_gc-8:33-2827  [000] ....  5314.793436: f2fs_background_gc: dev = (8,33), wait_ms = 300000, prefree = 0, free = 73

     then I made the partition satisfied the condition of has_enough_invalid_blocks, gc can get a victim and do garbage collection, wait_ms = 30s

     f2fs_gc-8:33-2827  [001] ....  5614.978486: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [001] ....  5614.978538: f2fs_get_victim: dev = (8,33), type = No TYPE, policy = (Background GC, LFS-mode, Cost-Benefit), victim = 441 ofs_unit = 1, pre_victim_secno = -1, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [000] ....  5644.996989: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 54
     f2fs_gc-8:33-2827  [000] ....  5644.997027: f2fs_get_victim: dev = (8,33), type = No TYPE, policy = (Background GC, LFS-mode, Cost-Benefit), victim = 97 ofs_unit = 1, pre_victim_secno = -1, prefree = 0, free = 54

     when there no dirty segments left, I think wait_ms could turn back to 300s

     f2fs_gc-8:33-2827  [000] ....  6305.596205: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 1, free = 64
     f2fs_gc-8:33-2827  [001] ....  6605.781281: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
     f2fs_gc-8:33-2827  [000] ....  6905.966301: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
     f2fs_gc-8:33-2827  [001] ....  7206.151344: f2fs_background_gc: dev = (8,33), wait_ms = 30000, prefree = 0, free = 65
	
     here, background gc triggers every 300s, but wait_ms is still 30s, I don't know why?

Best wishes,
Thanks
>   TRACE_EVENT(f2fs_get_victim,
>
>   	TP_PROTO(struct super_block *sb, int type, int gc_type,
>


  reply	other threads:[~2015-10-10  7:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 22:43 [PATCH 1/3] f2fs: introduce background_gc=sync mount option Jaegeuk Kim
2015-10-05 22:43 ` [PATCH 2/3] f2fs: add a tracepoint for background gc Jaegeuk Kim
2015-10-05 22:43   ` Jaegeuk Kim
2015-10-10  7:08   ` He YunLei [this message]
2015-10-10  7:08     ` [f2fs-dev] " He YunLei
2015-10-13 17:03     ` Jaegeuk Kim
2015-10-05 22:44 ` [PATCH 3/3] f2fs: introduce a periodic checkpoint flow Jaegeuk Kim
2015-10-05 22:44   ` Jaegeuk Kim
2015-10-06 14:54   ` [f2fs-dev] " Chao Yu
2015-10-06 14:54     ` Chao Yu
2015-10-06 23:25     ` Jaegeuk Kim

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=5618B96A.50205@huawei.com \
    --to=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.