io_uring/net: allow multishot receive per-invocation cap io_uring-recv-mshot-len
authorJens Axboe <axboe@kernel.dk>
Tue, 8 Jul 2025 01:38:45 +0000 (19:38 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 10 Jul 2025 17:52:14 +0000 (11:52 -0600)
commitb62c5171e3d3d356463ce4d84f42655789812b4a
treeba063121076c69aeae69a55dc5138d79d2e6aa94
parent590ad1108100b112c046fef55dc88c4464912ac5
io_uring/net: allow multishot receive per-invocation cap

If an application is handling multiple receive streams using recv
multishot, then the amount of retries and buffer peeking for multishot
and bundles can process too much per socket before moving on. This isn't
directly controllable by the application. By default, io_uring will
retry a recv MULTISHOT_MAX_RETRY (32) times, if the socket keeps having
data to receive. And if using bundles, then each bundle peek will
potentially map up to PEEK_MAX_IMPORT (256) iovecs of data. Once these
limits are hit, then a requeue operation will be done, where the request
will get retried after other pending requests have had a time to get
executed.

Add support for capping the per-invocation receive length, before a
requeue condition is considered for each receive. This is done by setting
sqe->mshot_len to the byte value. For example, if this is set to 1024,
then each receive will be requeued by 1024 bytes received.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/net.c