mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
io_uring: move zc reporting from the hot path
Add custom tw and notif callbacks on top of usual bits also handling zc reporting. That moves it from the hot path. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/40de4a6409042478e1f35adc4912e23226cb1b5c.1667557923.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
bedd20bcf3
commit
40725d1b96
@@ -923,6 +923,9 @@ void io_send_zc_cleanup(struct io_kiocb *req)
|
||||
}
|
||||
}
|
||||
|
||||
#define IO_ZC_FLAGS_COMMON (IORING_RECVSEND_POLL_FIRST | IORING_RECVSEND_FIXED_BUF)
|
||||
#define IO_ZC_FLAGS_VALID (IO_ZC_FLAGS_COMMON | IORING_SEND_ZC_REPORT_USAGE)
|
||||
|
||||
int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
|
||||
@@ -935,11 +938,6 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
if (req->flags & REQ_F_CQE_SKIP)
|
||||
return -EINVAL;
|
||||
|
||||
zc->flags = READ_ONCE(sqe->ioprio);
|
||||
if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST |
|
||||
IORING_RECVSEND_FIXED_BUF |
|
||||
IORING_SEND_ZC_REPORT_USAGE))
|
||||
return -EINVAL;
|
||||
notif = zc->notif = io_alloc_notif(ctx);
|
||||
if (!notif)
|
||||
return -ENOMEM;
|
||||
@@ -947,6 +945,17 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
notif->cqe.res = 0;
|
||||
notif->cqe.flags = IORING_CQE_F_NOTIF;
|
||||
req->flags |= REQ_F_NEED_CLEANUP;
|
||||
|
||||
zc->flags = READ_ONCE(sqe->ioprio);
|
||||
if (unlikely(zc->flags & ~IO_ZC_FLAGS_COMMON)) {
|
||||
if (zc->flags & ~IO_ZC_FLAGS_VALID)
|
||||
return -EINVAL;
|
||||
if (zc->flags & IORING_SEND_ZC_REPORT_USAGE) {
|
||||
io_notif_set_extended(notif);
|
||||
io_notif_to_data(notif)->zc_report = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
|
||||
unsigned idx = READ_ONCE(sqe->buf_index);
|
||||
|
||||
@@ -956,9 +965,6 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
req->imu = READ_ONCE(ctx->user_bufs[idx]);
|
||||
io_req_set_rsrc_node(notif, ctx, 0);
|
||||
}
|
||||
if (zc->flags & IORING_SEND_ZC_REPORT_USAGE) {
|
||||
io_notif_to_data(notif)->zc_report = true;
|
||||
}
|
||||
|
||||
if (req->opcode == IORING_OP_SEND_ZC) {
|
||||
if (READ_ONCE(sqe->__pad3[0]))
|
||||
|
Reference in New Issue
Block a user