]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ublk: use vmalloc for ublk_device's __queues
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 20 Jun 2025 15:09:55 +0000 (09:09 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:08:40 +0000 (12:08 +0200)
commitd89f71aece34474738fff62a55093a942eede1f8
treeef47703db96c45e0df864d8bdc52ac34b20d0d58
parentb35a50d639ca5259466ef5fea85529bb4fb17d5b
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>
drivers/block/ublk_drv.c