]> git.karo-electronics.de Git - karo-tx-linux.git/commit
net: SO_INCOMING_CPU setsockopt() support
authorEric Dumazet <edumazet@google.com>
Fri, 9 Oct 2015 02:33:21 +0000 (19:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Oct 2015 02:28:20 +0000 (19:28 -0700)
commit70da268b569d32a9fddeea85dc18043de9d89f89
tree6c698924212dcbfbb155e794f6089d2226889f0f
parentc7d39e32632e5db9dc4da51198b76d8c315946ff
net: SO_INCOMING_CPU setsockopt() support

SO_INCOMING_CPU as added in commit 2c8c56e15df3 was a getsockopt() command
to fetch incoming cpu handling a particular TCP flow after accept()

This commits adds setsockopt() support and extends SO_REUSEPORT selection
logic : If a TCP listener or UDP socket has this option set, a packet is
delivered to this socket only if CPU handling the packet matches the specified
one.

This allows to build very efficient TCP servers, using one listener per
RX queue, as the associated TCP listener should only accept flows handled
in softirq by the same cpu.
This provides optimal NUMA behavior and keep cpu caches hot.

Note that __inet_lookup_listener() still has to iterate over the list of
all listeners. Following patch puts sk_refcnt in a different cache line
to let this iteration hit only shared and read mostly cache lines.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
net/core/sock.c
net/ipv4/inet_hashtables.c
net/ipv4/udp.c
net/ipv6/inet6_hashtables.c
net/ipv6/udp.c