linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: don't bother wait_ms by foreground gc
@ 2022-07-18  3:28 qixiaoyu1
  2022-07-22  2:40 ` Jaegeuk Kim
  0 siblings, 1 reply; 4+ messages in thread
From: qixiaoyu1 @ 2022-07-18  3:28 UTC (permalink / raw)
  To: chao, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, qixiaoyu1

f2fs_gc returns -EINVAL via f2fs_balance_fs when there is enough free
secs after write checkpoint, but with gc_merge enabled, it will cause
the sleep time of gc thread to be set to no_gc_sleep_time even if there
are many dirty segments can be selected.

Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
---
 fs/f2fs/gc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index d5fb426e0747..cb8ca992d986 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -150,8 +150,12 @@ static int gc_thread_func(void *data)
 		gc_control.nr_free_secs = foreground ? 1 : 0;
 
 		/* if return value is not zero, no victim was selected */
-		if (f2fs_gc(sbi, &gc_control))
-			wait_ms = gc_th->no_gc_sleep_time;
+		if (f2fs_gc(sbi, &gc_control)) {
+			/* don't bother wait_ms by foreground gc */
+			if (!foreground) {
+				wait_ms = gc_th->no_gc_sleep_time;
+			}
+		}
 
 		if (foreground)
 			wake_up_all(&gc_th->fggc_wq);
-- 
2.36.1


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

* Re: [PATCH] f2fs: don't bother wait_ms by foreground gc
  2022-07-18  3:28 [PATCH] f2fs: don't bother wait_ms by foreground gc qixiaoyu1
@ 2022-07-22  2:40 ` Jaegeuk Kim
  2022-07-22  3:39   ` [PATCH v2] " qixiaoyu1
  2022-07-24 10:00   ` [PATCH] " Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2022-07-22  2:40 UTC (permalink / raw)
  To: qixiaoyu1; +Cc: chao, linux-f2fs-devel, linux-kernel, qixiaoyu1

On 07/18, qixiaoyu1 wrote:
> f2fs_gc returns -EINVAL via f2fs_balance_fs when there is enough free
> secs after write checkpoint, but with gc_merge enabled, it will cause
> the sleep time of gc thread to be set to no_gc_sleep_time even if there
> are many dirty segments can be selected.
> 
> Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
> ---
>  fs/f2fs/gc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index d5fb426e0747..cb8ca992d986 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -150,8 +150,12 @@ static int gc_thread_func(void *data)
>  		gc_control.nr_free_secs = foreground ? 1 : 0;
>  
>  		/* if return value is not zero, no victim was selected */
> -		if (f2fs_gc(sbi, &gc_control))
> -			wait_ms = gc_th->no_gc_sleep_time;
> +		if (f2fs_gc(sbi, &gc_control)) {
> +			/* don't bother wait_ms by foreground gc */
> +			if (!foreground) {
> +				wait_ms = gc_th->no_gc_sleep_time;
> +			}

I applied without {} to match the coding style.

Thanks,

> +		}
>  
>  		if (foreground)
>  			wake_up_all(&gc_th->fggc_wq);
> -- 
> 2.36.1

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

* [PATCH v2] f2fs: don't bother wait_ms by foreground gc
  2022-07-22  2:40 ` Jaegeuk Kim
@ 2022-07-22  3:39   ` qixiaoyu1
  2022-07-24 10:00   ` [PATCH] " Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: qixiaoyu1 @ 2022-07-22  3:39 UTC (permalink / raw)
  To: jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel, qixiaoyu1, qxy65535

f2fs_gc returns -EINVAL via f2fs_balance_fs when there is enough free
secs after write checkpoint, but with gc_merge enabled, it will cause
the sleep time of gc thread to be set to no_gc_sleep_time even if there
are many dirty segments can be selected.

Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
---
 fs/f2fs/gc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index d5fb426e0747..e2f8a2dae908 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -150,8 +150,11 @@ static int gc_thread_func(void *data)
 		gc_control.nr_free_secs = foreground ? 1 : 0;
 
 		/* if return value is not zero, no victim was selected */
-		if (f2fs_gc(sbi, &gc_control))
-			wait_ms = gc_th->no_gc_sleep_time;
+		if (f2fs_gc(sbi, &gc_control)) {
+			/* don't bother wait_ms by foreground gc */
+			if (!foreground)
+				wait_ms = gc_th->no_gc_sleep_time;
+		}
 
 		if (foreground)
 			wake_up_all(&gc_th->fggc_wq);
-- 
2.36.1


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

* Re: [PATCH] f2fs: don't bother wait_ms by foreground gc
  2022-07-22  2:40 ` Jaegeuk Kim
  2022-07-22  3:39   ` [PATCH v2] " qixiaoyu1
@ 2022-07-24 10:00   ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2022-07-24 10:00 UTC (permalink / raw)
  To: Jaegeuk Kim, qixiaoyu1; +Cc: linux-f2fs-devel, linux-kernel, qixiaoyu1

On 2022/7/22 10:40, Jaegeuk Kim wrote:
> On 07/18, qixiaoyu1 wrote:
>> f2fs_gc returns -EINVAL via f2fs_balance_fs when there is enough free
>> secs after write checkpoint, but with gc_merge enabled, it will cause
>> the sleep time of gc thread to be set to no_gc_sleep_time even if there
>> are many dirty segments can be selected.
>>
>> Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>

> 
> I applied without {} to match the coding style.

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

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

end of thread, other threads:[~2022-07-24 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18  3:28 [PATCH] f2fs: don't bother wait_ms by foreground gc qixiaoyu1
2022-07-22  2:40 ` Jaegeuk Kim
2022-07-22  3:39   ` [PATCH v2] " qixiaoyu1
2022-07-24 10:00   ` [PATCH] " Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).