public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-next 00/10] io_uring: batch multishot completions
@ 2022-11-21 10:03 Dylan Yudaken
  2022-11-21 10:03 ` [PATCH for-next 01/10] io_uring: merge io_req_tw_post and io_req_task_complete Dylan Yudaken
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Dylan Yudaken @ 2022-11-21 10:03 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken

Multishot completions currently all go through io_post_aux_cqe which will
do a lock/unlock pair of the completion spinlock, and also possibly signal
an eventfd if registered. This can slow down applications that use these
features.

This series allows the posted completions to be batched using the same
IO_URING_F_COMPLETE_DEFER as exists for non multishot completions. A
critical property of this is that all multishot completions must be
flushed to the CQ ring before the non-multishot completion (say an error)
or else ordering will break. This implies that if some completions were
deferred, then the rest must also be to keep that ordering. In order to do
this the first few patches move all the completion code into a simpler
path that defers completions when possible.

The batching is done by keeping an array of 16 CQEs, and adding to it
rather than posting immediately. If it fills up the posting happens then.

A microbenchmark was run ([1]) to test this and showed a 2.3x rps
improvment (8.3 M/s vs 19.3 M/s).

Patches 1-7 clean up the completion paths
Patch 8 introduces the cqe array
Patch 9 allows io_post_aux_cqe to use the cqe array to defer completions
Patch 10 enables defered completions for multishot polled requests

[1]: https://github.com/DylanZA/liburing/commit/9ac66b36bcf4477bfafeff1c5f107896b7ae31cf
Run with $ make -j && ./benchmark/reg.b -s 1 -t 2000 -r 10

Note - I this will have a merge conflict with the recent
"io_uring: inline __io_req_complete_post()" commit. I can respin once that
is in for-next.

Dylan Yudaken (10):
  io_uring: merge io_req_tw_post and io_req_task_complete
  io_uring: __io_req_complete should defer if available
  io_uring: split io_req_complete_failed into post/defer
  io_uring: lock on remove in io_apoll_task_func
  io_uring: timeout should use io_req_task_complete
  io_uring: simplify io_issue_sqe
  io_uring: make io_req_complete_post static
  io_uring: allow defer completion for aux posted cqes
  io_uring: allow io_post_aux_cqe to defer completion
  io_uring: allow multishot polled reqs to defer completion

 include/linux/io_uring_types.h |   2 +
 io_uring/io_uring.c            | 133 +++++++++++++++++++++++++--------
 io_uring/io_uring.h            |   5 +-
 io_uring/msg_ring.c            |  10 ++-
 io_uring/net.c                 |  15 ++--
 io_uring/poll.c                |   7 +-
 io_uring/rsrc.c                |   4 +-
 io_uring/timeout.c             |   3 +-
 8 files changed, 126 insertions(+), 53 deletions(-)


base-commit: 40fa774af7fd04d06014ac74947c351649b6f64f
-- 
2.30.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-21 17:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 10:03 [PATCH for-next 00/10] io_uring: batch multishot completions Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 01/10] io_uring: merge io_req_tw_post and io_req_task_complete Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 02/10] io_uring: __io_req_complete should defer if available Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 03/10] io_uring: split io_req_complete_failed into post/defer Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 04/10] io_uring: lock on remove in io_apoll_task_func Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 05/10] io_uring: timeout should use io_req_task_complete Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 06/10] io_uring: simplify io_issue_sqe Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 07/10] io_uring: make io_req_complete_post static Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 08/10] io_uring: allow defer completion for aux posted cqes Dylan Yudaken
2022-11-21 10:03 ` [PATCH for-next 09/10] io_uring: allow io_post_aux_cqe to defer completion Dylan Yudaken
2022-11-21 16:55   ` Jens Axboe
2022-11-21 17:31   ` Jens Axboe
2022-11-21 10:03 ` [PATCH for-next 10/10] io_uring: allow multishot polled reqs " Dylan Yudaken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox