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>
This commit is contained in:

committed by
David S. Miller

parent
421b3885bf
commit
fbf8866d65
@@ -1052,11 +1052,12 @@ e_inval:
|
||||
* destination in skb->cb[] before dst drop.
|
||||
* This way, receiver doesnt make cache line misses to read rtable.
|
||||
*/
|
||||
void ipv4_pktinfo_prepare(struct sk_buff *skb)
|
||||
void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);
|
||||
|
||||
if (skb_rtable(skb)) {
|
||||
if ((inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) &&
|
||||
skb_rtable(skb)) {
|
||||
pktinfo->ipi_ifindex = inet_iif(skb);
|
||||
pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user