public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Eddie Chapman <eddie@ehuk.net>
To: Coly Li <colyli@suse.de>
Cc: guoju <fangguoju@gmail.com>,
	kent.overstreet@gmail.com, linux-bcache@vger.kernel.org,
	linux-kernel@vger.kernel.org, s.priebe@profihost.ag
Subject: Re: [PATCH] bcache: add separate workqueue for journal_write to avoid deadlock
Date: Thu, 4 Oct 2018 15:07:54 +0100	[thread overview]
Message-ID: <17ea92fa-a07b-2391-aba3-377382c63d9b@ehuk.net> (raw)
In-Reply-To: <ef36fbef-9f2e-0208-aa00-bd9ba656de31@suse.de>

On 28/09/18 03:32, Coly Li wrote:
> 
> On 9/27/18 11:53 PM, Eddie Chapman wrote:
>> On 27/09/18 16:23, Coly Li wrote:
>>>
>>> On 9/27/18 9:45 PM, guoju wrote:
>>>> After write SSD completed, bcache schedule journal_write work to
>>>> system_wq, that is a public workqueue in system, without WQ_MEM_RECLAIM>>>> flag. system_wq is also a bound wq, and there may be no idle kworker on
>>>> current processor. Creating a new kworker may unfortunately need to
>>>> reclaim memory first, by shrinking cache and slab used by vfs, which
>>>> depends on bcache device. That's a deadlock.
>>>>
>>>> This patch create a new workqueue for journal_write with WQ_MEM_RECLAIM
>>>> flag. It's rescuer thread will work to avoid the deadlock.
>>>>
>>>> Signed-off-by: guoju <fangguoju@gmail.com>
>>>
>>> Nice catch, this fix is quite important. I will try to submit to Jens 
>>> ASAP.
>>>
>>> Thanks.
>>>
>>> Coly Li
>>
>> Once this goes into 4.19, would this be a candidate for backporting to 
>> any stable kernels, or does it only fix something introduced in this 
>> cycle?
>>
> This bug exists in upstream for quite long time, it should be applied to 
> all stable kernels which it can be applied. And it is Cced to 
> stable@vger.kernel.org already.
> 
> Coly Li

Thanks Coly! :-)

Just to let you know, I applied this (and couple of other cherry picks) 
to a couple of 4.14 boxes last night, so far so good, running without 
issues. However, this one needed this recent commit upstream as a 
pre-requisite:

16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244
bcache: do not assign in if condition in bcache_init()

in order to be able to apply it.

This is because the context of the second hunk for 
drivers/md/bcache/super.c (in this journal_write workqueue patch) 
contains code added by that commit 16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244.

So I guess either 16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244 also needs 
tagging for stable, or perhaps a backport of this journal_write 
workqueue will have to be created for earlier kernels, with different 
context for that hunk?

Eddie

  reply	other threads:[~2018-10-04 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 13:45 [PATCH] bcache: add separate workqueue for journal_write to avoid deadlock guoju
2018-09-27 15:23 ` Coly Li
2018-09-27 15:53   ` Eddie Chapman
2018-09-27 20:18     ` Stefan Priebe - Profihost AG
     [not found]     ` <2C0DE6F7-624B-49B6-9788-BA0A8E7DA25C@profihost.ag>
2018-09-28  2:31       ` Coly Li
2018-09-28  2:32     ` Coly Li
2018-10-04 14:07       ` Eddie Chapman [this message]
2018-10-16  6:27         ` Coly Li

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=17ea92fa-a07b-2391-aba3-377382c63d9b@ehuk.net \
    --to=eddie@ehuk.net \
    --cc=colyli@suse.de \
    --cc=fangguoju@gmail.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.priebe@profihost.ag \
    /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