Skip to content

io_uring: batch multishot completions

Dylan Yudaken io-uring 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 4 repliesApplied
  2. v213 patches 0 repliesSuperseded
  3. v110 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- rebase onto recent changes. A lot of duplicate changes so dropped 4 patches

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/9io_uring: io_req_complete_post should defer if availableio_uring/io_uring.c+3 -12 replies
2/9io_uring: always lock in io_apoll_task_funcio_uring/poll.c+2 -10 replies
3/9io_uring: defer all io_req_complete_failedio_uring/io_uring.c io_uring/io_uring.h io_uring/poll.c+10 -110 replies
4/9io_uring: allow defer completion for aux posted cqesinclude/linux/io_uring_types.h io_uring/io_uring.c+26 -31 reply
5/9io_uring: add io_aux_cqe which allows deferred completionio_uring/io_uring.c io_uring/io_uring.h io_uring/net.c +1 more+42 -50 replies
6/9io_uring: make io_fill_cqe_aux staticio_uring/io_uring.c io_uring/io_uring.h+2 -40 replies
7/9io_uring: add lockdep assertion in io_fill_cqe_auxio_uring/io_uring.c+2 -00 replies
8/9io_uring: remove overflow param from io_post_aux_cqeio_uring/io_uring.c io_uring/io_uring.h io_uring/msg_ring.c +1 more+13 -100 replies
9/9io_uring: allow multishot polled reqs to defer completionio_uring/io_uring.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH for-next v3 0/9] io_uring: batch multishot completions

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-3 clean up the completion paths
Patch 4 introduces the cqe array
Patch 5 allows io_post_aux_cqe to use the cqe array to defer completions Patches 6-8 are small cleanups
Patch 9 enables defered completions for multishot polled requests

v3:
- rebase onto recent changes. A lot of duplicate changes so dropped 4 patches

v2:
- Rebase. This includes having to deal with the allow_overflow flag
- split io_post_aux_cqe up
- remove msg_ring changes (as not needed)
- add the patch 10-12 cleanups

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

Dylan Yudaken (9):
io_uring: io_req_complete_post should defer if available
io_uring: always lock in io_apoll_task_func
io_uring: defer all io_req_complete_failed
io_uring: allow defer completion for aux posted cqes
io_uring: add io_aux_cqe which allows deferred completion
io_uring: make io_fill_cqe_aux static
io_uring: add lockdep assertion in io_fill_cqe_aux
io_uring: remove overflow param from io_post_aux_cqe
io_uring: allow multishot polled reqs to defer completion

 include/linux/io_uring_types.h |   2 +
 io_uring/io_uring.c            | 101 ++++++++++++++++++++++++++-------
 io_uring/io_uring.h            |   9 ++-
 io_uring/msg_ring.c            |   4 +-
 io_uring/net.c                 |   7 ++-
 io_uring/poll.c                |   9 +--
 io_uring/rsrc.c                |   4 +-
 7 files changed, 101 insertions(+), 35 deletions(-)

base-commit: 6321e75e0bc52b0feff9643292acc92494c00e8d

Signature · 1 line
2.30.2