f2fs: reset wait_ms to default if any of the victims have been selected
authorYuwei Guan <ssawgyw@gmail.com>
Sun, 11 Dec 2022 13:08:41 +0000 (21:08 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 12 Dec 2022 23:18:36 +0000 (15:18 -0800)
In non-foreground gc mode, if no victim is selected, the gc process
will wait for no_gc_sleep_time before waking up again. In this
subsequent time, even though a victim will be selected, the gc process
still waits for no_gc_sleep_time before waking up. The configuration
of wait_ms is not reasonable.

After any of the victims have been selected, we need to reset wait_ms to
default sleep time from no_gc_sleep_time.

Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c

index f0c6506d89758d784d9141463d59ef2e8bca512f..d7a9d84ba57c1a128ab2d9d86c6d424bab9cf534 100644 (file)
@@ -141,6 +141,10 @@ do_gc:
                        /* don't bother wait_ms by foreground gc */
                        if (!foreground)
                                wait_ms = gc_th->no_gc_sleep_time;
+               } else {
+                       /* reset wait_ms to default sleep time */
+                       if (wait_ms == gc_th->no_gc_sleep_time)
+                               wait_ms = gc_th->min_sleep_time;
                }
 
                if (foreground)