Skip to content

RFC improve io_uring's ubuf_info refcounting

Pavel Begunkov io-uring kvm lkml netdev xen-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11net: introduce struct ubuf_info_msgzcinclude/linux/skbuff.h+21 -00 replies
2/11xen/netback: use struct ubuf_info_msgzcdrivers/net/xen-netback/common.h drivers/net/xen-netback/interface.c drivers/net/xen-netback/netback.c+7 -60 replies
3/11vhost/net: use struct ubuf_info_msgzcdrivers/vhost/net.c+9 -80 replies
4/11net: shrink struct ubuf_infoinclude/linux/skbuff.h net/core/skbuff.c net/ipv4/ip_output.c +2 more+28 -380 replies
5/11net: rename ubuf_info's flagsinclude/linux/skbuff.h io_uring/notif.c net/core/skbuff.c+4 -40 replies
6/11net: add flags for controlling ubuf_infoinclude/linux/skbuff.h io_uring/notif.c net/core/skbuff.c+3 -00 replies
7/11net/tcp: optimise tcp ubuf refcountinginclude/linux/skbuff.h net/ipv4/tcp.c+13 -30 replies
8/11net: let callers provide ->msg_ubuf refsinclude/linux/skbuff.h net/ipv4/ip_output.c net/ipv6/ip6_output.c+16 -00 replies
9/11io_uring/notif: add helper for flushing refsio_uring/notif.c+9 -50 replies
10/11io_uring/notif: mark notifs with UARGFL_CALLER_PINNEDio_uring/notif.c+1 -10 replies
11/11io_uring/notif: add ubuf_info ref cachingio_uring/net.c io_uring/notif.c io_uring/notif.h+32 -40 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC net-next io_uring 00/11] improve io_uring's ubuf_info refcounting

There is a couple of tricks we can do with io_uring to improve ubuf_info refcounting. First, we ammortise reference grabbing and then give them away to the network layer, which is implemented in 8 and 11. Also, we don't need need additional pinning for TCP, which is removed by 7.

1-4 are needed because otherwise we're out of space in io_notif_data and using ->desc or some other field of ubuf_info would be ugly. It'll also facilitate further ideas like adding a simpler notification model for UDP.

liburing/examples/io_uring-sendzc benchmark using a branch containing the patchset and some more [1] showed ~1.6% qps improvement for UDP (dummy dev), and ~1% for TCP (localhost + hacks enabling zc).

I didn't specifically test xen and vhost and not sure how, would love some help with that.

[1] https://github.com/isilence/linux/tree/net/zc-ref-optimisation

Pavel Begunkov (11):
net: introduce struct ubuf_info_msgzc xen/netback: use struct ubuf_info_msgzc vhost/net: use struct ubuf_info_msgzc
net: shrink struct ubuf_info
net: rename ubuf_info's flags
net: add flags for controlling ubuf_info net/tcp: optimise tcp ubuf refcounting
net: let callers provide ->msg_ubuf refs io_uring/notif: add helper for flushing refs io_uring/notif: mark notifs with UARGFL_CALLER_PINNED io_uring/notif: add ubuf_info ref caching

 drivers/net/xen-netback/common.h    |  2 +-
 drivers/net/xen-netback/interface.c |  4 +--
 drivers/net/xen-netback/netback.c   |  7 +++---
 drivers/vhost/net.c                 | 17 +++++++------
 include/linux/skbuff.h              | 35 +++++++++++++++++++++++---
 io_uring/net.c                      |  8 +++++-
 io_uring/notif.c                    | 21 ++++++++++------
 io_uring/notif.h                    | 22 +++++++++++++++-
 net/core/skbuff.c                   | 39 ++++++++++++++++-------------
 net/ipv4/ip_output.c                |  3 ++-
 net/ipv4/tcp.c                      | 11 +++++---
 net/ipv6/ip6_output.c               |  3 ++-
 12 files changed, 123 insertions(+), 49 deletions(-)
Signature · 1 line
2.37.0