[PATCH] block: restore mempool reserves for non-block
From: Carlos Llamas
Date: Sat May 02 2026 - 20:17:43 EST
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@xxxxxxxxxx>
---
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