Re: [PATCH net-next] net: ipv6: Add early demux handler for UDP unicast
From: Eric Dumazet <hidden>
Date: 2017-03-08 18:49:52
On Wed, 2017-03-08 at 11:24 -0700, Subash Abhinov Kasiviswanathan wrote:
While running a single stream UDPv6 test, we observed that amount of CPU spent in NET_RX softirq was much greater than UDPv4 for an equivalent receive rate. The test here was run on an ARM64 based Android system. On further analysis with perf, we found that UDPv6 was spending significant time in the statistics netfilter targets which did socket lookup per packet. These statistics rules perform a lookup when there is no socket associated with the skb. Since there are multiple instances of these rules based on UID, there will be equal number of lookups per skb. By introducing early demux for UDPv6, we avoid the redundant lookups. This also helped to improve the performance (800Mbps -> 870Mbps) on a CPU limited system in a single stream UDPv6 receive test with 1450 byte sized datagrams using iperf.
Well, this 'optimization' actually hurts when UDP sockets are not connected, since this adds an extra cache line miss per incoming packet. (DNS servers for example)
Signed-off-by: Subash Abhinov Kasiviswanathan <redacted> ---
+ + if (dst) + dst = dst_check(dst, 0);
IPv6 uses a cookie to validate dst, not 0.