From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>, Brian Foster <bfoster@redhat.com>,
"Darrick J. Wong" <djwong@kernel.org>,
Dave Chinner <dchinner@redhat.com>
Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: iomap: writeback ioend/bio allocation deadlock risk
Date: Fri, 21 May 2021 11:27:54 +0800 [thread overview]
Message-ID: <YKcouuVR/y/L4T58@T590> (raw)
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
next reply other threads:[~2021-05-21 3:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 3:27 Ming Lei [this message]
2021-05-21 7:17 ` iomap: writeback ioend/bio allocation deadlock risk 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
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=YKcouuVR/y/L4T58@T590 \
--to=ming.lei@redhat.com \
--cc=bfoster@redhat.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox