Skip to content

Move io_buffer_list out of struct io_kiocb

Jens Axboe io-uring 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 0 repliesNew
  2. v19 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Drop 'issue_flags' from both io_put_kbuf() and io_put_kbufs(), unused in both.
- Add patch folding 'ret' in io_send_finish() with io_br_sel, just like was previously done on the receive side.
- Add patch checking for REQ_F_BUFFER_RING first in recycling.
- Rebase on current for-6.18/io_uring branch.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12io_uring/kbuf: drop 'issue_flags' from io_put_kbuf(s)() argumentsio_uring/io_uring.c io_uring/kbuf.h io_uring/net.c +1 more+14 -170 replies
2/12io_uring/net: don't use io_net_kbuf_recyle() for non-provided casesio_uring/net.c+3 -30 replies
3/12io_uring/net: clarify io_recv_buf_select() return valueio_uring/net.c+1 -10 replies
4/12io_uring/kbuf: pass in struct io_buffer_list to commit/recycle helpersio_uring/io_uring.c io_uring/kbuf.c io_uring/kbuf.h +3 more+45 -400 replies
5/12io_uring/kbuf: introduce struct io_br_selio_uring/kbuf.c io_uring/kbuf.h io_uring/net.c +1 more+59 -380 replies
6/12io_uring/rw: recycle buffers manually for non-mshot readsio_uring/rw.c+2 -00 replies
7/12io_uring/kbuf: use struct io_br_sel for multiple buffers pickingio_uring/kbuf.c io_uring/kbuf.h io_uring/net.c+25 -230 replies
8/12io_uring/net: use struct io_br_sel->val as the recv finish valueio_uring/net.c+19 -160 replies
9/12io_uring/net: use struct io_br_sel->val as the send finish valueio_uring/net.c+12 -100 replies
10/12io_uring/kbuf: switch to storing struct io_buffer_list locallyinclude/linux/io_uring_types.h io_uring/io_uring.c io_uring/kbuf.c +4 more+55 -740 replies
11/12io_uring: remove async/poll related provided buffer recyclesio_uring/io_uring.c io_uring/poll.c+0 -60 replies
12/12io_uring/kbuf: check for ring provided buffers first in recyclingio_uring/kbuf.h+2 -20 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCHSET v2 0/12] Move io_buffer_list out of struct io_kiocb

Hi,

One thing that has annoyed me is that struct io_buffer_list is inside struct io_kiocb, as they have potentially drastically different lifetimes. This makes it easy to screw up, even if you think you know what you are doing, as you need to understand the intricacies of provided buffer ring lifetimes.

This patchset adds a struct io_br_sel, which is used for buffer selection, and which also then stores the io_buffer_list whenever it is safe to do so. io_br_sel resides on the stack of the user, and hence cannot leak outside of that scope.

With this, we can also cleanup some of the random recycle points we have in the code base in general.

Should not have any functional changes, unless I screwed up of course. Passes full liburing tests as well.

Can also be found here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-buf-list

 include/linux/io_uring_types.h |   6 --
 io_uring/io_uring.c            |   4 +-
 io_uring/kbuf.c                |  67 ++++++++-------
 io_uring/kbuf.h                |  57 +++++++-----
 io_uring/net.c                 | 153 ++++++++++++++++-----------------
 io_uring/poll.c                |   4 -
 io_uring/rw.c                  |  56 ++++++------
 7 files changed, 177 insertions(+), 170 deletions(-)

Since v1:
- Drop 'issue_flags' from both io_put_kbuf() and io_put_kbufs(), unused in both.
- Add patch folding 'ret' in io_send_finish() with io_br_sel, just like was previously done on the receive side.
- Add patch checking for REQ_F_BUFFER_RING first in recycling.
- Rebase on current for-6.18/io_uring branch.

Signature · 1 line
Jens Axboe