Improve async state handling
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest17 patches 12 repliesIn review
- v115 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- Cleanups
- Switch connect to using io_async_msghdr, now it gets recycling too
- Avoid recycling for read/write if io-wq is used
- Fix errant io_async_rw shadowing in io_write()
- Change alloc_cache to be array based
- Fix KASAN issues. Not with mem reuse, but just errors in my implementation of it for the mempool.
- Only mark iovec caching as REQ_F_NEED_CLEANUP
- Shuffle some hunks around between patches
- Fix an issue with send zerocopy and iovec freeing
- Move connect to io_async_msghdr so it can tap into the recycling
- Actually delete struct io_rw_state, not just its elements
- Add uring_cmd optimization that avoids sqe copy unless needed
- Rebase on for-6.10/io_uring
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/17 | io_uring/net: switch io_send() and io_send_zc() to using io_async_msghdrio_uring/ io_uring/ | +103 | 2 replies | |
| 2/17 | io_uring/net: switch io_recv() to using io_async_msghdrio_uring/ io_uring/ io_uring/ | +53 | 0 replies | |
| 3/17 | io_uring/net: unify cleanup handlingio_uring/ | +11 | 0 replies | |
| 4/17 | io_uring/net: always setup an io_async_msghdrio_uring/ | +47 | 0 replies | |
| 5/17 | io_uring/net: get rid of ->prep_async() for receive sideio_uring/ io_uring/ io_uring/ | +28 | 0 replies | |
| 6/17 | io_uring/net: get rid of ->prep_async() for send sideio_uring/ io_uring/ io_uring/ | +50 | 0 replies | |
| 7/17 | io_uring: kill io_msg_alloc_async_prep()io_uring/ | +10 | 0 replies | |
| 8/17 | io_uring/net: add iovec recyclingio_uring/ io_uring/ | +93 | 0 replies | |
| 9/17 | io_uring/net: drop 'kmsg' parameter from io_req_msg_cleanup()io_uring/ | +5 | 0 replies | |
| 10/17 | io_uring/rw: always setup io_async_rw for read/write requestsinclude/ io_uring/ io_uring/ +2 more | +278 | 2 replies | |
| 11/17 | io_uring: get rid of struct io_rw_stateio_uring/ io_uring/ | +26 | 0 replies | |
| 12/17 | io_uring/rw: add iovec recyclingio_uring/ io_uring/ | +39 | 0 replies | |
| 13/17 | io_uring/net: move connect to always using async dataio_uring/ io_uring/ io_uring/ | +12 | 0 replies | |
| 14/17 | io_uring/uring_cmd: switch to always allocating async datainclude/ io_uring/ io_uring/ +2 more | +69 | 0 replies | |
| 15/17 | io_uring/uring_cmd: defer SQE copying until we need itio_uring/ | +19 | 2 replies | |
| 16/17 | io_uring: drop ->prep_async()io_uring/ io_uring/ io_uring/ +2 more | +26 | 2 replies | |
| 17/17 | io_uring/alloc_cache: switch to array based cachinginclude/ io_uring/ io_uring/ +12 more | +82 | 4 replies |
Reviews trailers per patch
1 of 17 patches has a Reviewed-by or Acked-by.
| Patch | Anuj Gupta |
|---|---|
| 1/17 | |
| 2/17 | |
| 3/17 | |
| 4/17 | |
| 5/17 | |
| 6/17 | |
| 7/17 | |
| 8/17 | |
| 9/17 | |
| 10/17 | |
| 11/17 | |
| 12/17 | |
| 13/17 | |
| 14/17 | |
| 15/17 | T-b R-b |
| 16/17 | |
| 17/17 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCHSET v2 0/17] Improve async state handling
Hi,
This patchset gets rid of on-stack state, that is then fixed up and copied if we need to go async. Having to do this fixup is nasty business, and this is the main motivation for the change.
Opcodes are converted to setting up their async context at prep time, which means that everything is stable beyond that. No more special io_req_prep_async() handling, and no more "oops we can't proceed, let's now allocate memory, copy state, and be ready for a retry". By default, opcodes are now always ready for a retry, and the issue path can be simplified. This is most readily apparent in the read/write handling, but can be seen on the net side too.
Lastly, the alloc cache is rewritten to be array based rather than list based. List based isn't a great choice, as grabbing an element from the list also means you have to touch the next one.
With all of that, performance is as good as before, or better, and we drop quite a bit of code.
The diffstat reflects that, but doesn't even tell the full story. Most of the added lines are trivial, whereas some of the removed lines are pretty hairy.
Changes since v1:
- Cleanups
- Switch connect to using io_async_msghdr, now it gets recycling too
- Avoid recycling for read/write if io-wq is used
- Fix errant io_async_rw shadowing in io_write()
- Change alloc_cache to be array based
- Fix KASAN issues. Not with mem reuse, but just errors in my implementation of it for the mempool.
- Only mark iovec caching as REQ_F_NEED_CLEANUP
- Shuffle some hunks around between patches
- Fix an issue with send zerocopy and iovec freeing
- Move connect to io_async_msghdr so it can tap into the recycling
- Actually delete struct io_rw_state, not just its elements
- Add uring_cmd optimization that avoids sqe copy unless needed
- Rebase on for-6.10/io_uring
include/linux/io_uring_types.h | 4 +- io_uring/alloc_cache.h | 51 ++-- io_uring/futex.c | 26 +- io_uring/futex.h | 5 +- io_uring/io_uring.c | 71 ++--- io_uring/io_uring.h | 1 - io_uring/net.c | 550 +++++++++++++++++---------------------- io_uring/net.h | 27 +- io_uring/opdef.c | 65 ++--- io_uring/opdef.h | 9 +- io_uring/poll.c | 11 +- io_uring/poll.h | 7 +- io_uring/rsrc.c | 9 +- io_uring/rsrc.h | 5 +- io_uring/rw.c | 570 +++++++++++++++++++++-------------------- io_uring/rw.h | 25 +- io_uring/uring_cmd.c | 75 ++++-- io_uring/uring_cmd.h | 7 +- 18 files changed, 707 insertions(+), 811 deletions(-)
Signature · 1 line
Jens Axboe