From: Jens Axboe <[email protected]>
To: [email protected]
Subject: [PATCHSET v2 0/17] Improve async state handling
Date: Wed, 20 Mar 2024 16:55:15 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
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(-)
--
Jens Axboe
next reply other threads:[~2024-03-20 22:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 22:55 Jens Axboe [this message]
2024-03-20 22:55 ` [PATCH 01/17] io_uring/net: switch io_send() and io_send_zc() to using io_async_msghdr Jens Axboe
2024-04-06 20:58 ` Pavel Begunkov
2024-04-07 21:47 ` Jens Axboe
2024-03-20 22:55 ` [PATCH 02/17] io_uring/net: switch io_recv() " Jens Axboe
2024-03-20 22:55 ` [PATCH 03/17] io_uring/net: unify cleanup handling Jens Axboe
2024-03-20 22:55 ` [PATCH 04/17] io_uring/net: always setup an io_async_msghdr Jens Axboe
2024-03-20 22:55 ` [PATCH 05/17] io_uring/net: get rid of ->prep_async() for receive side Jens Axboe
2024-03-20 22:55 ` [PATCH 06/17] io_uring/net: get rid of ->prep_async() for send side Jens Axboe
2024-03-20 22:55 ` [PATCH 07/17] io_uring: kill io_msg_alloc_async_prep() Jens Axboe
2024-03-20 22:55 ` [PATCH 08/17] io_uring/net: add iovec recycling Jens Axboe
2024-03-20 22:55 ` [PATCH 09/17] io_uring/net: drop 'kmsg' parameter from io_req_msg_cleanup() Jens Axboe
2024-03-20 22:55 ` [PATCH 10/17] io_uring/rw: always setup io_async_rw for read/write requests Jens Axboe
2024-03-25 12:03 ` Anuj gupta
2024-03-25 14:54 ` Jens Axboe
2024-03-20 22:55 ` [PATCH 11/17] io_uring: get rid of struct io_rw_state Jens Axboe
2024-03-20 22:55 ` [PATCH 12/17] io_uring/rw: add iovec recycling Jens Axboe
2024-03-20 22:55 ` [PATCH 13/17] io_uring/net: move connect to always using async data Jens Axboe
2024-03-20 22:55 ` [PATCH 14/17] io_uring/uring_cmd: switch to always allocating " Jens Axboe
2024-03-20 22:55 ` [PATCH 15/17] io_uring/uring_cmd: defer SQE copying until we need it Jens Axboe
2024-03-25 12:41 ` Anuj gupta
2024-03-25 14:55 ` Jens Axboe
2024-03-20 22:55 ` [PATCH 16/17] io_uring: drop ->prep_async() Jens Axboe
2024-04-06 20:54 ` Pavel Begunkov
2024-04-07 21:46 ` Jens Axboe
2024-03-20 22:55 ` [PATCH 17/17] io_uring/alloc_cache: switch to array based caching Jens Axboe
2024-03-21 15:59 ` Gabriel Krisman Bertazi
2024-03-21 16:38 ` Jens Axboe
2024-03-21 17:20 ` Gabriel Krisman Bertazi
2024-03-21 17:22 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox