io_uring: add support for IORING_SETUP_CLAMP
authorJens Axboe <axboe@kernel.dk>
Sat, 28 Dec 2019 22:39:54 +0000 (15:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Sun, 29 Dec 2019 16:05:24 +0000 (09:05 -0700)
commitd0c9ff979551f289bbb37884c6c530f8565a0d48
tree2e528813304334a54a8d40c562afe1b1dfbc1f87
parentdfc79c078cc967396dd4063e805978167b254b5f
io_uring: add support for IORING_SETUP_CLAMP

Some applications like to start small in terms of ring size, and then
ramp up as needed. This is a bit tricky to do currently, since we don't
advertise the max ring size.

This adds IORING_SETUP_CLAMP. If set, and the values for SQ or CQ ring
size exceed what we support, then clamp them at the max values instead
of returning -EINVAL. Since we return the chosen ring sizes after setup,
no further changes are needed on the application side. io_uring already
changes the ring sizes if the application doesn't ask for power-of-two
sizes, for example.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/uapi/linux/io_uring.h