io_uring/zcrx: allow synchronous buffer return

Returning buffers via a ring is performant and convenient, but it
becomes a problem when/if the user misconfigured the ring size and it
becomes full. Add a synchronous way to return buffers back to the page
pool via a new register opcode. It's supposed to be a reliable slow
path for refilling.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov
2025-09-16 15:28:02 +01:00
committed by Jens Axboe
parent 8fd08d8dda
commit 705d2ac7b2
4 changed files with 90 additions and 0 deletions

View File

@@ -689,6 +689,9 @@ enum io_uring_register_op {
/* query various aspects of io_uring, see linux/io_uring/query.h */
IORING_REGISTER_QUERY = 35,
/* return zcrx buffers back into circulation */
IORING_REGISTER_ZCRX_REFILL = 36,
/* this goes last */
IORING_REGISTER_LAST,
@@ -1070,6 +1073,15 @@ struct io_uring_zcrx_ifq_reg {
__u64 __resv[3];
};
struct io_uring_zcrx_sync_refill {
__u32 zcrx_id;
/* the number of entries to return */
__u32 nr_entries;
/* pointer to an array of struct io_uring_zcrx_rqe */
__u64 rqes;
__u64 __resv[2];
};
#ifdef __cplusplus
}
#endif