Skip to content

RFC optimise UDP skb completion wakeups

Pavel Begunkov netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2udp: introduce udp specific skb destructordrivers/net/veth.c include/net/sock.h include/net/udp.h +3 more+60 -80 replies
2/2udp: optimise write wakeups with SOCK_NOSPACEnet/ipv4/udp.c+17 -20 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC 0/2] optimise UDP skb completion wakeups

sock_wfree() tries to wake even when there are only read waiters and no write waiters, which is the common scenario for io_uring. It'd also attempt to wake if the write queue is far from being full. To avoid most of this overhead add SOCK_NOSPACE support for UDP.

It brings +5% to UDP throughput with a CPU bound benchmark, and I observed it taking 0.5-2% according to profiles in more realistic workloads.

Patch 1 introduces a new destructor udp_wfree(). The optimisation can be implemented in sock_wfree() but that would either require patching up all poll callbacks across the tree that are used in couple with sock_wfree(), or limiting it to UDP with a flag.

Another option considered was to split out a write waitqueue, perhaps conditionally, but it's bulkier, and the current version should also benefit epoll workloads.

Pavel Begunkov (2):
udp: introduce udp specific skb destructor
udp: optimise write wakeups with SOCK_NOSPACE

 drivers/net/veth.c | 10 +++++---
 include/net/sock.h |  1 +
 include/net/udp.h  |  1 +
 net/core/sock.c    | 10 +++++---
 net/ipv4/udp.c     | 58 ++++++++++++++++++++++++++++++++++++++++++++--
 net/ipv6/udp.c     |  5 +++-
 6 files changed, 76 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0