netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] udp: reduce cache pressure
@ 2017-06-12  9:23 Paolo Abeni
  2017-06-12  9:23 ` [PATCH net-next v3 1/3] net: factor out a helper to decrement the skb refcount Paolo Abeni
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Paolo Abeni @ 2017-06-12  9:23 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Eric Dumazet

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(-)

-- 
2.9.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-07-18  7:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-12  9:23 [PATCH net-next v3 0/3] udp: reduce cache pressure Paolo Abeni
2017-06-12  9:23 ` [PATCH net-next v3 1/3] net: factor out a helper to decrement the skb refcount Paolo Abeni
2017-06-12  9:23 ` [PATCH net-next v3 2/3] udp: avoid a cache miss on dequeue Paolo Abeni
2017-07-17  7:04   ` Eric Dumazet
2017-07-17 20:59     ` [PATCH net] udp: preserve skb->dst if required for IP options processing Paolo Abeni
2017-07-17 21:26       ` Eric Dumazet
2017-07-18  7:50         ` Paolo Abeni
2017-07-17 21:30       ` Eric Dumazet
2017-07-17 21:35         ` Eric Dumazet
2017-06-12  9:23 ` [PATCH net-next v3 3/3] udp: try to avoid 2 cache miss on dequeue Paolo Abeni
2017-06-22 13:06   ` DNS (?) not working on G5 (64-bit powerpc) (was [net-next, v3, 3/3] udp: try to avoid 2 cache miss on dequeue) Michael Ellerman
2017-06-22 16:43     ` DNS (?) not working on G5 (64-bit powerpc) (was [net-next,v3,3/3] " Paolo Abeni
2017-06-22 20:27       ` Paolo Abeni
2017-06-22 20:28       ` Paolo Abeni
2017-06-22 20:57     ` Paolo Abeni
2017-06-22 21:18       ` Hannes Frederic Sowa
2017-06-23  6:59         ` Michael Ellerman
2017-06-23 11:59           ` Paolo Abeni
2017-06-26  3:15             ` Michael Ellerman
2017-06-12 14:01 ` [PATCH net-next v3 0/3] udp: reduce cache pressure David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).