All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [bug report] scsi: sd_zbc: emulate ZONE_APPEND commands
Date: Wed, 17 Feb 2021 11:05:37 +0100	[thread overview]
Message-ID: <YCzqcXH6DAPC4rcb@dhcp22.suse.cz> (raw)
In-Reply-To: <SN4PR0401MB359849D173B08EB61A6CE9F19B869@SN4PR0401MB3598.namprd04.prod.outlook.com>

On Wed 17-02-21 09:41:58, Johannes Thumshirn wrote:
> On 17/02/2021 10:36, Michal Hocko wrote:
> > On Wed 17-02-21 09:08:07, Johannes Thumshirn wrote:
> >> On 17/02/2021 09:03, Michal Hocko wrote:
> >>>> No I don't think so. A mutex isn't a spinlock so we can sleep on the allocation.
> >>>> We can't use GFP_KERNEL as we're about to do I/O. blk_revalidate_disk_zones() called
> >>>> a few line below also does the memalloc_noio_{save,restore}() dance.
> >>>
> >>> You should be extending noio scope then if this allocation falls into
> >>> the same category. Ideally the scope should start at the recursion place
> >>> and end where the scope really ened.
> >>
> >> That means all callers of blk_revalidate_disk_zones() should do 
> >> memalloc_noio_{save,restore}?
> > 
> > I am not really familiar with the IO area to answer this. The base idea
> > is to start the NOIO scope at the boundary which defines "unsafe to
> > re-enter or cannot deal with a new IO" from the reclaim path.
> > 
> >> If yes, can we somehow runtime assert that this is done, so we don't
> >> end up with bad surprises?
> > 
> > Could you elaborate?
> 
> I though of lifting the noio scope into the callers of 
> blk_revalidate_disk_zones() and then "check" in blk_revalidate_disk_zones()
> this has been done. But it looks like memalloc_noio_save() can handle nesting,
> so this is actually unneeded.

Yes, it can handle nesting. As to where to start the scope, this should
be at the boundary of "do not reenter IO path from the reclaim". This
can be a lock which is held for the allocation which will be needed for
an IO induced by the reclaim or any other resouce that will block from
the IO path. Is this more clear now?
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2021-02-17 10:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 19:39 [bug report] scsi: sd_zbc: emulate ZONE_APPEND commands Dan Carpenter
2021-02-16 23:33 ` Damien Le Moal
2021-02-17  6:42   ` Johannes Thumshirn
2021-02-17  8:00     ` Damien Le Moal
2021-02-17  8:03     ` Michal Hocko
2021-02-17  9:08       ` Johannes Thumshirn
2021-02-17  9:36         ` Michal Hocko
2021-02-17  9:41           ` Johannes Thumshirn
2021-02-17 10:05             ` Michal Hocko [this message]
2021-02-17  9:13       ` Damien Le Moal
2021-02-17  9:18         ` Johannes Thumshirn
2021-02-17 11:16           ` Dan Carpenter
2021-02-17 11:18             ` Johannes Thumshirn
2021-02-17  9:32         ` Michal Hocko

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=YCzqcXH6DAPC4rcb@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.