History

io_uring/nop: add IORING_NOP_TW completion flag

To test and profile the overhead of io_uring task_work and the various types of it, add IORING_NOP_TW which tells nop to signal completions through task_work rather than complete them inline.

Jens Axboe committed 1 year ago

Commit cb9ccfb1 parent ecf47d42 files · +8 −1Browse files

Unified · Split

2 files
  1. include/uapi/linux/io_uring.h +1 −0
  2. io_uring/nop.c +7 −1
include/uapi/linux/io_uring.h+1−0
@@ -449,6 +449,7 @@ enum io_uring_msg_ring_flags { · 448 unmodified lines
449449 #define IORING_NOP_FILE (1U << 1)
450450 #define IORING_NOP_FIXED_FILE (1U << 2)
451451 #define IORING_NOP_FIXED_BUFFER (1U << 3)
452+#define IORING_NOP_TW (1U << 4)
452453
453454 /*
454455 * IO completion data structure (Completion Queue Entry)
io_uring/nop.c+7−1
@@ -20,7 +20,8 @@ struct io_nop { · 19 unmodified lines
2020 };
2121
2222 #define NOP_FLAGS (IORING_NOP_INJECT_RESULT | IORING_NOP_FIXED_FILE | \
23− IORING_NOP_FIXED_BUFFER | IORING_NOP_FILE)
23+ IORING_NOP_FIXED_BUFFER | IORING_NOP_FILE | \
24+ IORING_NOP_TW)
2425
2526 int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
2627 {
@@ -68,5 +69,10 @@ done: · 41 unmodified lines
6869 if (ret < 0)
6970 req_set_fail(req);
7071 io_req_set_res(req, nop->result, 0);
72+ if (nop->flags & IORING_NOP_TW) {
73+ req->io_task_work.func = io_req_task_complete;
74+ io_req_task_work_add(req);
75+ return IOU_ISSUE_SKIP_COMPLETE;
76+ }
7177 return IOU_COMPLETE;
7278 }