mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 3/3] f2fs: flush stale issued discard candidates
Date: Tue, 18 Dec 2018 14:43:51 -0800	[thread overview]
Message-ID: <20181218224351.GC31062@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <639940cc-f7a8-e679-3b28-3b3b2485652b@huawei.com>

On 12/18, Chao Yu wrote:
> On 2018/12/14 13:01, Jaegeuk Kim wrote:
> > Sometimes, I could observe # of issuing_discard to be 1 which blocks background
> > jobs due to is_idle()=false.
> > The only way to get out of it was to trigger gc_urgent. This patch avoids that
> > by checking any candidates as done in the list.
> 
> Well, as below code, once we issued discard commands, we will wait all
> queued discard end their IO, so do you know what flow can cause such
> condition...?

It's very subtle, and I suspect somehow race condition not from here.

> 
> 		issued = __issue_discard_cmd(sbi, &dpolicy);
> 		if (issued > 0) {
> 			__wait_all_discard_cmd(sbi, &dpolicy);
> 
> Or, I doubt that 'issued' statistical info could be wrong.

No, it simply came back to 0 with this patch. So, something is pending
in the queue even if it is done.

Thanks,

> 
> Thanks,
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/segment.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index 49ea9009ab5a..acbbc924e518 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1651,6 +1651,10 @@ static int issue_discard_thread(void *data)
> >  		if (dcc->discard_wake)
> >  			dcc->discard_wake = 0;
> >  
> > +		/* clean up pending candidates before going to sleep */
> > +		if (atomic_read(&dcc->queued_discard))
> > +			__wait_all_discard_cmd(sbi, NULL);
> > +
> >  		if (try_to_freeze())
> >  			continue;
> >  		if (f2fs_readonly(sbi->sb))
> > 

  reply	other threads:[~2018-12-18 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  5:01 [PATCH 1/3] f2fs: use kvmalloc, if kmalloc is failed Jaegeuk Kim
2018-12-14  5:01 ` [PATCH 2/3] f2fs: correct wrong spelling, issing_* Jaegeuk Kim
2018-12-18  8:39   ` [f2fs-dev] " Chao Yu
2018-12-14  5:01 ` [PATCH 3/3] f2fs: flush stale issued discard candidates Jaegeuk Kim
2018-12-18  8:49   ` [f2fs-dev] " Chao Yu
2018-12-18 22:43     ` Jaegeuk Kim [this message]
2018-12-19  3:21       ` Chao Yu
2018-12-18  8:37 ` [f2fs-dev] [PATCH 1/3] f2fs: use kvmalloc, if kmalloc is failed 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=20181218224351.GC31062@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

all inboxes | Powered by JetHome®