]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
blk-crypto: use mempool_alloc_bulk for encrypted bio page allocation
authorChristoph Hellwig <hch@lst.de>
Fri, 9 Jan 2026 06:07:47 +0000 (07:07 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Jan 2026 19:55:41 +0000 (12:55 -0700)
commit3d939695e68218d420be2b5dbb2fa39ccb7e97ed
treeb9920c53912a19ff9b3e7ff31da484b3036c3d36
parent2f655dcb2d925b55deb8c1ec8f42b522c6bc5698
blk-crypto: use mempool_alloc_bulk for encrypted bio page allocation

Calling mempool_alloc in a loop is not safe unless the maximum allocation
size times the maximum number of threads using it is less than the
minimum pool size.  Use the new mempool_alloc_bulk helper to allocate
all missing elements in one pass to remove this deadlock risk.  This
also means that non-pool allocations now use alloc_pages_bulk which can
be significantly faster than a loop over individual page allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-crypto-fallback.c