public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: restore mempool reserves for non-block
@ 2026-05-03  0:17 Carlos Llamas
  2026-05-03  4:26 ` Bart Van Assche
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Llamas @ 2026-05-03  0:17 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe, Martin K. Petersen,
	Chaitanya Kulkarni
  Cc: kernel-team, linux-kernel, Carlos Llamas, open list:BLOCK LAYER

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


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

end of thread, other threads:[~2026-05-04  4:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03  0:17 [PATCH] block: restore mempool reserves for non-block Carlos Llamas
2026-05-03  4:26 ` Bart Van Assche
2026-05-03 15:01   ` Carlos Llamas
2026-05-04  4:44     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox