* [PATCH] f2fs: avoid frequent background GC @ 2013-04-25 2:44 Jaegeuk Kim 2013-04-25 5:06 ` Namjae Jeon 0 siblings, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2013-04-25 2:44 UTC (permalink / raw) Cc: Jaegeuk Kim, linux-fsdevel, linux-kernel, linux-f2fs-devel 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 10 minutes. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> --- fs/f2fs/gc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 30b2db0..1190d57 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -13,9 +13,9 @@ * whether IO subsystem is idle * or not */ -#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ +#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ #define GC_THREAD_MAX_SLEEP_TIME 30000 -#define GC_THREAD_NOGC_SLEEP_TIME 10000 +#define GC_THREAD_NOGC_SLEEP_TIME 600000 /* wait 10 min */ #define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */ #define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */ -- 1.8.1.3.566.gaa39828 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: avoid frequent background GC 2013-04-25 2:44 [PATCH] f2fs: avoid frequent background GC Jaegeuk Kim @ 2013-04-25 5:06 ` Namjae Jeon 2013-04-25 11:00 ` [PATCH v2] " Jaegeuk Kim 0 siblings, 1 reply; 4+ messages in thread From: Namjae Jeon @ 2013-04-25 5:06 UTC (permalink / raw) To: Jaegeuk Kim; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel Hi Jaegeuk, With the change in the value of GC_THREAD_NOGC_SLEEP_TIME to 600000, we will need to rewrite the gc_thread_func(). As there will be several paths which will not be reached or will have no meaning after this change. Considering the cases: /* if return value is not zero, no victim was selected */ if (f2fs_gc(sbi)) wait_ms = GC_THREAD_NOGC_SLEEP_TIME; else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME) wait_ms = GC_THREAD_MAX_SLEEP_TIME; Before this point, there are ‘2’ functions to change ‘wait_ms” -> increase_sleep_time and decrease_sleep_time. When we consider increase_sleep_time() - the maximum possible value for ‘wait_ms’ after coming out of this can be: GC_THREAD_MAX_SLEEP_TIME And in case in the last iteration it was set to GC_THREAD_NOGC_SLEEP_TIME, once it enters increase_sleep_time() - the value will be reseted to maximum GC_THREAD_MAX_SLEEP_TIME. So, else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME) wait_ms = GC_THREAD_MAX_SLEEP_TIME; becomes unreachable path. And second, maybe, After setting to GC_THREAD_NOGC_SLEEP_TIME(10min), Although there are invalid blocks, GC thread might be sleep 9min 50sec. Let me know your opinion. Thanks. 2013/4/25, Jaegeuk Kim <jaegeuk.kim@samsung.com>: > 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 10 minutes. > > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> > --- > fs/f2fs/gc.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h > index 30b2db0..1190d57 100644 > --- a/fs/f2fs/gc.h > +++ b/fs/f2fs/gc.h > @@ -13,9 +13,9 @@ > * whether IO subsystem is idle > * or not > */ > -#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ > +#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ > #define GC_THREAD_MAX_SLEEP_TIME 30000 > -#define GC_THREAD_NOGC_SLEEP_TIME 10000 > +#define GC_THREAD_NOGC_SLEEP_TIME 600000 /* wait 10 min */ > #define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */ > #define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */ > > -- > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] f2fs: avoid frequent background GC 2013-04-25 5:06 ` Namjae Jeon @ 2013-04-25 11:00 ` Jaegeuk Kim 2013-04-25 23:52 ` Namjae Jeon 0 siblings, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2013-04-25 11:00 UTC (permalink / raw) To: Namjae Jeon; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel [-- Attachment #1: Type: text/plain, Size: 2663 bytes --] Hi, Namjae, Agreed. How about this? Chang log from v1: o change timings - min 30s, max 60s, nogc 5 min o remove nonreachable routine o consider NOGC_SLEEP_TIME in increate/decrease_sleep_time From 806e344624414fcf9fc87f6193265859027d51b5 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim <jaegeuk.kim@samsung.com> Date: Wed, 24 Apr 2013 13:00:14 +0900 Subject: [PATCH] f2fs: avoid frequent background GC Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net 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. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> --- fs/f2fs/gc.c | 3 --- fs/f2fs/gc.h | 12 +++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 1ca3324..6ed3263 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -82,9 +82,6 @@ static int gc_thread_func(void *data) /* if return value is not zero, no victim was selected */ if (f2fs_gc(sbi)) 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()); return 0; } diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 30b2db0..2c6a6bd 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -13,9 +13,9 @@ * whether IO subsystem is idle * or not */ -#define GC_THREAD_MIN_SLEEP_TIME 10000 /* milliseconds */ -#define GC_THREAD_MAX_SLEEP_TIME 30000 -#define GC_THREAD_NOGC_SLEEP_TIME 10000 +#define GC_THREAD_MIN_SLEEP_TIME 30000 /* milliseconds */ +#define GC_THREAD_MAX_SLEEP_TIME 60000 +#define GC_THREAD_NOGC_SLEEP_TIME 300000 /* wait 5 min */ #define LIMIT_INVALID_BLOCK 40 /* percentage over total user 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) static inline long increase_sleep_time(long wait) { + if (wait == GC_THREAD_NOGC_SLEEP_TIME) + return wait; + wait += GC_THREAD_MIN_SLEEP_TIME; if (wait > GC_THREAD_MAX_SLEEP_TIME) wait = GC_THREAD_MAX_SLEEP_TIME; @@ -66,6 +69,9 @@ static inline long increase_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; if (wait <= GC_THREAD_MIN_SLEEP_TIME) wait = GC_THREAD_MIN_SLEEP_TIME; -- 1.8.1.3.566.gaa39828 -- Jaegeuk Kim Samsung [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] f2fs: avoid frequent background GC 2013-04-25 11:00 ` [PATCH v2] " Jaegeuk Kim @ 2013-04-25 23:52 ` Namjae Jeon 0 siblings, 0 replies; 4+ messages in thread From: Namjae Jeon @ 2013-04-25 23:52 UTC (permalink / raw) To: jaegeuk.kim; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel 2013/4/25, Jaegeuk Kim <jaegeuk.kim@samsung.com>: > Hi, Namjae, > > Agreed. How about this? > > Chang log from v1: > o change timings - min 30s, max 60s, nogc 5 min > o remove nonreachable routine > o consider NOGC_SLEEP_TIME in increate/decrease_sleep_time > > From 806e344624414fcf9fc87f6193265859027d51b5 Mon Sep 17 00:00:00 2001 > From: Jaegeuk Kim <jaegeuk.kim@samsung.com> > Date: Wed, 24 Apr 2013 13:00:14 +0900 > Subject: [PATCH] f2fs: avoid frequent background GC > Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-f2fs-devel@lists.sourceforge.net > > 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. > > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> Looks good! Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com> Thanks~ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-25 23:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-25 2:44 [PATCH] f2fs: avoid frequent background GC Jaegeuk Kim 2013-04-25 5:06 ` Namjae Jeon 2013-04-25 11:00 ` [PATCH v2] " Jaegeuk Kim 2013-04-25 23:52 ` Namjae Jeon
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).