]> git.baikalelectronics.ru Git - kernel.git/commit
soreuseport: fast reuseport UDP socket selection
authorCraig Gallek <kraig@google.com>
Mon, 4 Jan 2016 22:41:46 +0000 (17:41 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jan 2016 03:49:58 +0000 (22:49 -0500)
commit19a6a54d7cdd94ea45a364c06a38e53079b26071
treef3176589179db2e0df7a306bb3564ef6c6fddc17
parentdccb6f21d1df10bc13d73955b12161a5f8cb2136
soreuseport: fast reuseport UDP socket selection

Include a struct sock_reuseport instance when a UDP socket binds to
a specific address for the first time with the reuseport flag set.
When selecting a socket for an incoming UDP packet, use the information
available in sock_reuseport if present.

This required adding an additional field to the UDP source address
equality function to differentiate between exact and wildcard matches.
The original use case allowed wildcard matches when checking for
existing port uses during bind.  The new use case of adding a socket
to a reuseport group requires exact address matching.

Performance test (using a machine with 2 CPU sockets and a total of
48 cores):  Create reuseport groups of varying size.  Use one socket
from this group per user thread (pinning each thread to a different
core) calling recvmmsg in a tight loop.  Record number of messages
received per second while saturating a 10G link.
  10 sockets: 18% increase (~2.8M -> 3.3M pkts/s)
  20 sockets: 14% increase (~2.9M -> 3.3M pkts/s)
  40 sockets: 13% increase (~3.0M -> 3.4M pkts/s)

This work is based off a similar implementation written by
Ying Cai <ycai@google.com> for implementing policy-based reuseport
selection.

Signed-off-by: Craig Gallek <kraig@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/addrconf.h
include/net/udp.h
net/ipv4/udp.c
net/ipv6/inet6_connection_sock.c
net/ipv6/udp.c