All of lore.kernel.org
 help / color / mirror / Atom feed
* iomap: writeback ioend/bio allocation deadlock risk
@ 2021-05-21  3:27 Ming Lei
  2021-05-21  7:17 ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: Ming Lei @ 2021-05-21  3:27 UTC (permalink / raw)
  To: Christoph Hellwig, Brian Foster, Darrick J. Wong, Dave Chinner
  Cc: linux-block, linux-fsdevel

Hello Guys,

I found there may be two deadlock risk under memory pressure wrt.
ioend/bio allocation in iomap writeback code wrt. bio_alloc_bioset():

        if %__gfp_direct_reclaim is set then bio_alloc will always be able to
        allocate a bio.  this is due to the mempool guarantees.  to make this work,
        callers must never allocate more than 1 bio at a time from the general pool.
        callers that need to allocate more than 1 bio must always submit the
        previously allocated bio for io before attempting to allocate a new one.
        failure to do so can cause deadlocks under memory pressure.

1) more than one ioends can be allocated from 'iomap_ioend_bioset'
before submitting them all, so mempoll guarantee can't be made, which can
be observed frequently in writeback over ext4

2) more than one chained bio(allocated from fs_bio_set) via iomap_chain_bio,
which is easy observed when writing big files on XFS:

- the old bio is submitted _after_ the new allocation
- submission on old chained bio can't make forward progress because all chained
bios can only be freed after the whole ioend is completed, see iomap_finish_ioend()

Both looks not hard to fix, just want to make sure they are real issues?


Thanks,
Ming


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-05-25  8:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  3:27 iomap: writeback ioend/bio allocation deadlock risk Ming Lei
2021-05-21  7:17 ` Christoph Hellwig
2021-05-21  7:31   ` Ming Lei
2021-05-21  7:35     ` Christoph Hellwig
2021-05-21  8:35       ` Ming Lei
2021-05-21  8:36         ` Christoph Hellwig
2021-05-21  8:54           ` Ming Lei
2021-05-24 15:32             ` Christoph Hellwig
2021-05-24 23:55             ` Dave Chinner
2021-05-25  4:54               ` Ming Lei
2021-05-25  6:28                 ` Ming Lei
2021-05-25  8:21                   ` Dave Chinner

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.