summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorCaleb Sander Mateos <csander@purestorage.com>2025-06-20 09:09:55 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-15 12:13:32 +0200
commit0e5c17c2376bc0af719d002631a1d321b9e6def3 (patch)
tree4f1300f9fe1e3fe96020040a8d41104c1f8f3025 /drivers/block
parent3ed2cc6a6e93fbeb8c0cafce1e7fb1f64a331dcc (diff)
downloadlinux-0e5c17c2376bc0af719d002631a1d321b9e6def3.tar.gz
linux-0e5c17c2376bc0af719d002631a1d321b9e6def3.tar.bz2
linux-0e5c17c2376bc0af719d002631a1d321b9e6def3.zip
ublk: use vmalloc for ublk_device's __queues
[ Upstream commit c2f48453b7806d41f5a3270f206a5cd5640ed207 ] struct ublk_device's __queues points to an allocation with up to UBLK_MAX_NR_QUEUES (4096) queues, each of which have: - struct ublk_queue (48 bytes) - Tail array of up to UBLK_MAX_QUEUE_DEPTH (4096) struct ublk_io's, 32 bytes each This means the full allocation can exceed 512 MB, which may well be impossible to service with contiguous physical pages. Switch to kvcalloc() and kvfree(), since there is no need for physically contiguous memory. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver") Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250620151008.3976463-2-csander@purestorage.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/ublk_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 3b1a5cdd6311..defcc964ecab 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -2116,7 +2116,7 @@ static void ublk_deinit_queues(struct ublk_device *ub)
for (i = 0; i < nr_queues; i++)
ublk_deinit_queue(ub, i);
- kfree(ub->__queues);
+ kvfree(ub->__queues);
}
static int ublk_init_queues(struct ublk_device *ub)
@@ -2127,7 +2127,7 @@ static int ublk_init_queues(struct ublk_device *ub)
int i, ret = -ENOMEM;
ub->queue_size = ubq_size;
- ub->__queues = kcalloc(nr_queues, ubq_size, GFP_KERNEL);
+ ub->__queues = kvcalloc(nr_queues, ubq_size, GFP_KERNEL);
if (!ub->__queues)
return ret;