net: Add sysctl to toggle early demux for tcp and udp
authorsubashab@codeaurora.org <subashab@codeaurora.org>
Thu, 23 Mar 2017 19:34:16 +0000 (13:34 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Mar 2017 20:17:07 +0000 (13:17 -0700)
commitdddb64bcb34615bf48a2c9cb9881eb76795cc5c5
treedff7f083a71c3016dd2d09c0f9fac18546e9eddf
parent8fa96e3bf6c04af61fc0a32ad64d648322c4d29d
net: Add sysctl to toggle early demux for tcp and udp

Certain system process significant unconnected UDP workload.
It would be preferrable to disable UDP early demux for those systems
and enable it for TCP only.

By disabling UDP demux, we see these slight gains on an ARM64 system-
782 -> 788Mbps unconnected single stream UDPv4
633 -> 654Mbps unconnected UDPv4 different sources

The performance impact can change based on CPU architecure and cache
sizes. There will not much difference seen if entire UDP hash table
is in cache.

Both sysctls are enabled by default to preserve existing behavior.

v1->v2: Change function pointer instead of adding conditional as
suggested by Stephen.

v2->v3: Read once in callers to avoid issues due to compiler
optimizations. Also update commit message with the tests.

v3->v4: Store and use read once result instead of querying pointer
again incorrectly.

v4->v5: Refactor to avoid errors due to compilation with IPV6={m,n}

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Suggested-by: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Tom Herbert <tom@herbertland.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
Documentation/networking/ip-sysctl.txt
include/net/netns/ipv4.h
include/net/protocol.h
include/net/udp.h
net/ipv4/af_inet.c
net/ipv4/ip_input.c
net/ipv4/protocol.c
net/ipv4/sysctl_net_ipv4.c
net/ipv6/ip6_input.c
net/ipv6/protocol.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c