提交 6cb968d9 编写于 作者: J Jaegeuk Kim

f2fs: avoid frequent background GC

If there is no victim segments selected by background GC, let's wait
a little bit longer time to collect dirty segments.
By default, let's give 5 minutes.
Reviewed-by: NNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
上级 2af4bd6c
...@@ -82,9 +82,6 @@ static int gc_thread_func(void *data) ...@@ -82,9 +82,6 @@ static int gc_thread_func(void *data)
/* if return value is not zero, no victim was selected */ /* if return value is not zero, no victim was selected */
if (f2fs_gc(sbi)) if (f2fs_gc(sbi))
wait_ms = GC_THREAD_NOGC_SLEEP_TIME; wait_ms = GC_THREAD_NOGC_SLEEP_TIME;
else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME)
wait_ms = GC_THREAD_MAX_SLEEP_TIME;
} while (!kthread_should_stop()); } while (!kthread_should_stop());
return 0; return 0;
} }
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
* whether IO subsystem is idle * whether IO subsystem is idle
* or not * or not
*/ */
#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ #define GC_THREAD_MIN_SLEEP_TIME 30000 /* milliseconds */
#define GC_THREAD_MAX_SLEEP_TIME 30000 #define GC_THREAD_MAX_SLEEP_TIME 60000
#define GC_THREAD_NOGC_SLEEP_TIME 10000 #define GC_THREAD_NOGC_SLEEP_TIME 300000 /* wait 5 min */
#define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */ #define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */
#define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */ #define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */
...@@ -58,6 +58,9 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi) ...@@ -58,6 +58,9 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi)
static inline long increase_sleep_time(long wait) static inline long increase_sleep_time(long wait)
{ {
if (wait == GC_THREAD_NOGC_SLEEP_TIME)
return wait;
wait += GC_THREAD_MIN_SLEEP_TIME; wait += GC_THREAD_MIN_SLEEP_TIME;
if (wait > GC_THREAD_MAX_SLEEP_TIME) if (wait > GC_THREAD_MAX_SLEEP_TIME)
wait = GC_THREAD_MAX_SLEEP_TIME; wait = GC_THREAD_MAX_SLEEP_TIME;
...@@ -66,6 +69,9 @@ static inline long increase_sleep_time(long wait) ...@@ -66,6 +69,9 @@ static inline long increase_sleep_time(long wait)
static inline long decrease_sleep_time(long wait) static inline long decrease_sleep_time(long wait)
{ {
if (wait == GC_THREAD_NOGC_SLEEP_TIME)
wait = GC_THREAD_MAX_SLEEP_TIME;
wait -= GC_THREAD_MIN_SLEEP_TIME; wait -= GC_THREAD_MIN_SLEEP_TIME;
if (wait <= GC_THREAD_MIN_SLEEP_TIME) if (wait <= GC_THREAD_MIN_SLEEP_TIME)
wait = GC_THREAD_MIN_SLEEP_TIME; wait = GC_THREAD_MIN_SLEEP_TIME;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册