net: ipv4 only populate IP_PKTINFO when needed
authorShawn Bohrer <sbohrer@rgmadvisors.com>
Mon, 7 Oct 2013 16:01:40 +0000 (11:01 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Oct 2013 20:27:33 +0000 (16:27 -0400)
commitfbf8866d65d5de84f75563eb0edd7fc27dbe9a90
tree150188e64b62233edb22aefe9e57ed90196388da
parent421b3885bf6d56391297844f43fb7154a6396e12
net: ipv4 only populate IP_PKTINFO when needed

The since the removal of the routing cache computing
fib_compute_spec_dst() does a fib_table lookup for each UDP multicast
packet received.  This has introduced a performance regression for some
UDP workloads.

This change skips populating the packet info for sockets that do not have
IP_PKTINFO set.

Benchmark results from a netperf UDP_RR test:
Before 89789.68 transactions/s
After  90587.62 transactions/s

Benchmark results from a fio 1 byte UDP multicast pingpong test
(Multicast one way unicast response):
Before 12.63us RTT
After  12.48us RTT

Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
net/ipv4/ip_sockglue.c
net/ipv4/raw.c
net/ipv4/udp.c