Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ublk: use vmalloc for ublk_device's __queues

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>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
c2f48453 ba83e321

+2 -2
+2 -2
drivers/block/ublk_drv.c
··· 2512 2512 2513 2513 for (i = 0; i < nr_queues; i++) 2514 2514 ublk_deinit_queue(ub, i); 2515 - kfree(ub->__queues); 2515 + kvfree(ub->__queues); 2516 2516 } 2517 2517 2518 2518 static int ublk_init_queues(struct ublk_device *ub) ··· 2523 2523 int i, ret = -ENOMEM; 2524 2524 2525 2525 ub->queue_size = ubq_size; 2526 - ub->__queues = kcalloc(nr_queues, ubq_size, GFP_KERNEL); 2526 + ub->__queues = kvcalloc(nr_queues, ubq_size, GFP_KERNEL); 2527 2527 if (!ub->__queues) 2528 2528 return ret; 2529 2529