Skip to content

udp: reduce cache pressure

Paolo Abeni linux-next linuxppc-dev netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 11 repliesIn review
  2. v23 patches 6 repliesSuperseded
  3. v13 patches 15 repliesSuperseded

Changes in v3 from the cover letter

- no changes, tested against apachebench for performances regression

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: factor out a helper to decrement the skb refcountinclude/linux/skbuff.h net/core/datagram.c net/core/skbuff.c+18 -130 replies
2/3udp: avoid a cache miss on dequeueinclude/linux/skbuff.h net/core/skbuff.c net/ipv4/udp.c+27 -56 replies
3/3udp: try to avoid 2 cache miss on dequeuenet/ipv4/udp.c+103 -119 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchEric Dumazet
1/3A-b
2/3A-b A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH net-next v3 0/3] udp: reduce cache pressure

In the most common use case, many skb fields are not used by recvmsg(), and the few ones actually accessed lays on cold cachelines, which leads to several cache miss per packet.

This patch series attempts to reduce such misses with different strategies:
* caching the interesting fields in the scratched space
* avoid accessing at all uninteresting fields
* prefetching

Tested using the udp_sink program by Jesper[1] as the receiver, an h/w l4 rx hash on the ingress nic, so that the number of ingress nic rx queues hit by the udp traffic could be controlled via ethtool -L.

The udp_sink program was bound to the first idle cpu, to get more stable numbers.

On a single numa node receiver:

nic rx queues           vanilla                 patched kernel      delta
1                       1850 kpps               1850 kpps           0%
2                       2370 kpps               2700 kpps           13.9%
16                      2000 kpps               2220 kpps           11%

[1] https://github.com/netoptimizer/network-testing/blob/master/src/udp_sink.c

v1 -> v2:
- replaced secpath_reset() with skb_release_head_state()
- changed udp_dev_scratch fields types to u{32,16} variant, replaced bitfield with bool

v2 -> v3:
- no changes, tested against apachebench for performances regression

Paolo Abeni (3):
net: factor out a helper to decrement the skb refcount
udp: avoid a cache miss on dequeue
udp: try to avoid 2 cache miss on dequeue

 include/linux/skbuff.h |  15 +++++++
 net/core/datagram.c    |   4 +-
 net/core/skbuff.c      |  38 ++++++++++------
 net/ipv4/udp.c         | 120 ++++++++++++++++++++++++++++++++++++++++++++-----
 4 files changed, 148 insertions(+), 29 deletions(-)
Signature · 1 line
2.9.4