From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v3] f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc
Date: Thu, 9 Aug 2018 18:46:14 -0700 [thread overview]
Message-ID: <20180810014614.GA44979@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <b09cdcf8-f8cd-98b6-54c1-82b2fb0f8b81@huawei.com>
On 08/10, Chao Yu wrote:
> On 2018/8/10 3:59, Jaegeuk Kim wrote:
> > Yup, how about this?
> >
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> > index d816c328f02b..cb510fb36523 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -1052,6 +1052,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
> > .iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS),
> > };
> > unsigned long long last_skipped = sbi->skipped_atomic_files[FG_GC];
> > + unsigned long long first_skipped;
> > unsigned int skipped_round = 0, round = 0;
> >
> > trace_f2fs_gc_begin(sbi->sb, sync, background,
> > @@ -1064,8 +1065,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
> > prefree_segments(sbi));
> >
> > cpc.reason = __get_cp_reason(sbi);
> > - sbi->skipped_gc_rwsem = 0;
> > gc_more:
> > + sbi->skipped_gc_rwsem = 0;
> > + first_skipped = last_skipped;
> > +
> > if (unlikely(!(sbi->sb->s_flags & SB_ACTIVE))) {
> > ret = -EINVAL;
> > goto stop;
> > @@ -1126,8 +1129,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
> > goto gc_more;
> > }
> >
> > - if (sbi->skipped_atomic_files[FG_GC] == last_skipped &&
> > - sbi->skipped_atomic_files[FG_GC] >
> > + if (first_skipped < last_skipped &&
> > + (last_skipped - first_skipped) >
>
> IMO, it would be better to judge the condition with skipped number in all round
> of FGGC instead of last round, since number in last round may not very accurate.
Yup, moved before gc_more.
>
> Thoughts?
>
> Thanks,
>
> > sbi->skipped_gc_rwsem) {
> > f2fs_drop_inmem_pages_all(sbi, true);
> > segno = NULL_SEGNO;
> >
> > .
> >
next prev parent reply other threads:[~2018-08-10 1:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 1:32 [PATCH] f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc Jaegeuk Kim
2018-07-30 3:29 ` Chao Yu
2018-07-30 4:18 ` Jaegeuk Kim
2018-07-30 6:36 ` Chao Yu
2018-07-30 9:08 ` Jaegeuk Kim
2018-07-30 9:28 ` Chao Yu
2018-07-30 10:00 ` Jaegeuk Kim
2018-08-04 2:31 ` [f2fs-dev] " Chao Yu
2018-08-12 10:24 ` Chao Yu
2018-08-13 20:12 ` Jaegeuk Kim
2018-08-14 6:21 ` Chao Yu
2018-08-04 22:29 ` [PATCH v2] " Jaegeuk Kim
2018-08-05 14:42 ` [f2fs-dev] " Chao Yu
2018-08-05 16:08 ` Jaegeuk Kim
2018-08-05 16:34 ` [f2fs-dev] [PATCH v3] " Jaegeuk Kim
2018-08-09 1:44 ` Chao Yu
2018-08-09 19:59 ` Jaegeuk Kim
2018-08-10 1:36 ` Chao Yu
2018-08-10 1:46 ` Jaegeuk Kim [this message]
2018-08-20 7:13 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180810014614.GA44979@jaegeuk-macbookpro.roam.corp.google.com \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).