From: Carlos Llamas <cmllamas@google.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Chaitanya Kulkarni <kch@nvidia.com>
Cc: kernel-team@android.com, linux-kernel@vger.kernel.org,
Carlos Llamas <cmllamas@google.com>,
"open list:BLOCK LAYER" <linux-block@vger.kernel.org>
Subject: [PATCH] block: restore mempool reserves for non-block
Date: Sun, 3 May 2026 00:17:33 +0000 [thread overview]
Message-ID: <20260503001734.858296-1-cmllamas@google.com> (raw)
Commit b520c4eef83d ("block: split bio_alloc_bioset more clearly into a
fast and slowpath") prevents non-blocking allocations from falling back
to mempool_alloc() after the initial slab allocation has failed. This
was based on the assumption that mempool_alloc() would simply retry the
slab and fail again (for non-block).
However, mempool_alloc() also attempts to dip into the pool reserves,
even for non-blocking requests, and this option is no longer available
after adding the early fail. This was noticed through the SCSI generic
module which calls blk_rq_map_user_io() with GFP_ATOMIC.
Remove the check to allow mempool reserves to be used for non-blocking
requests, restoring the previous behavior.
Fixes: b520c4eef83d ("block: split bio_alloc_bioset more clearly into a fast and slowpath")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
block/bio.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index b8972dba68a0..e8f4934593b3 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -576,13 +576,6 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
}
if (unlikely(!bio)) {
- /*
- * Give up if we are not allow to sleep as non-blocking mempool
- * allocations just go back to the slab allocation.
- */
- if (!(saved_gfp & __GFP_DIRECT_RECLAIM))
- return NULL;
-
punt_bios_to_rescuer(bs);
/*
--
2.54.0.545.g6539524ca2-goog
next reply other threads:[~2026-05-03 0:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 0:17 Carlos Llamas [this message]
2026-05-03 4:26 ` [PATCH] block: restore mempool reserves for non-block Bart Van Assche
2026-05-03 15:01 ` Carlos Llamas
2026-05-04 4:44 ` Christoph Hellwig
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=20260503001734.858296-1-cmllamas@google.com \
--to=cmllamas@google.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=kernel-team@android.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.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