All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC
@ 2021-03-17  8:28 Weichao Guo via Linux-f2fs-devel
  2021-03-17  9:09 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Weichao Guo via Linux-f2fs-devel @ 2021-03-17  8:28 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: fh, linux-f2fs-devel

AT_SSR mode is introduced by age threshold based GC for better
hot/cold data seperation and avoiding free segment cost. However,
LFS write mode is preferred in the scenario of foreground or high
urgent GC, which should be finished ASAP. Let's only use AT_SSR
in background GC and not high urgent GC modes.

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
---
 fs/f2fs/gc.c      | 3 ++-
 fs/f2fs/segment.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 86ba8ed..0f2c34f 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1120,7 +1120,8 @@ static int move_data_block(struct inode *inode, block_t bidx,
 	block_t newaddr;
 	int err = 0;
 	bool lfs_mode = f2fs_lfs_mode(fio.sbi);
-	int type = fio.sbi->am.atgc_enabled ?
+	int type = fio.sbi->am.atgc_enabled && gc_type == BG_GC &&
+				fio.sbi->gc_mode != GC_URGENT_HIGH ?
 				CURSEG_ALL_DATA_ATGC : CURSEG_COLD_DATA;
 
 	/* do not read out */
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 32b915e..81be3e9 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3264,7 +3264,9 @@ static int __get_segment_type_6(struct f2fs_io_info *fio)
 		struct inode *inode = fio->page->mapping->host;
 
 		if (is_cold_data(fio->page)) {
-			if (fio->sbi->am.atgc_enabled)
+			if (fio->sbi->am.atgc_enabled &&
+				fio->io_type == FS_DATA_IO &&
+				fio->sbi->gc_mode != GC_URGENT_HIGH)
 				return CURSEG_ALL_DATA_ATGC;
 			else
 				return CURSEG_COLD_DATA;
-- 
2.7.4



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC
  2021-03-17  8:28 [f2fs-dev] [PATCH] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC Weichao Guo via Linux-f2fs-devel
@ 2021-03-17  9:09 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2021-03-17  9:09 UTC (permalink / raw)
  To: Weichao Guo, jaegeuk, chao; +Cc: fh, linux-f2fs-devel

On 2021/3/17 16:28, Weichao Guo via Linux-f2fs-devel wrote:
> AT_SSR mode is introduced by age threshold based GC for better
> hot/cold data seperation and avoiding free segment cost. However,
> LFS write mode is preferred in the scenario of foreground or high
> urgent GC, which should be finished ASAP. Let's only use AT_SSR
> in background GC and not high urgent GC modes.
> 
> Signed-off-by: Weichao Guo <guoweichao@oppo.com>
> Signed-off-by: Huang Jianan <huangjianan@oppo.com>
> ---

v2:
...

>   fs/f2fs/gc.c      | 3 ++-
>   fs/f2fs/segment.c | 4 +++-
>   2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 86ba8ed..0f2c34f 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -1120,7 +1120,8 @@ static int move_data_block(struct inode *inode, block_t bidx,
>   	block_t newaddr;
>   	int err = 0;
>   	bool lfs_mode = f2fs_lfs_mode(fio.sbi);
> -	int type = fio.sbi->am.atgc_enabled ?
> +	int type = fio.sbi->am.atgc_enabled && gc_type == BG_GC &&
> +				fio.sbi->gc_mode != GC_URGENT_HIGH ?
>   				CURSEG_ALL_DATA_ATGC : CURSEG_COLD_DATA;

Minor thing:

.. && (gc_type == BG_GC) &&
(fio.sbi->gc_mode != GC_URGENT_HIGH)

I guess it will be better to use parenthesis to improve readability,
so that we don't need to check priority from different operators.

>   
>   	/* do not read out */
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 32b915e..81be3e9 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3264,7 +3264,9 @@ static int __get_segment_type_6(struct f2fs_io_info *fio)
>   		struct inode *inode = fio->page->mapping->host;
>   
>   		if (is_cold_data(fio->page)) {
> -			if (fio->sbi->am.atgc_enabled)
> +			if (fio->sbi->am.atgc_enabled &&
> +				fio->io_type == FS_DATA_IO &&
> +				fio->sbi->gc_mode != GC_URGENT_HIGH)

Ditto,

Otherwise, it looks good to me, you can add below tag in next version:

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

>   				return CURSEG_ALL_DATA_ATGC;
>   			else
>   				return CURSEG_COLD_DATA;



> 


_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2021-03-17  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17  8:28 [f2fs-dev] [PATCH] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC Weichao Guo via Linux-f2fs-devel
2021-03-17  9:09 ` Chao Yu

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.