diff options
author | Shawn Bohrer <sbohrer@rgmadvisors.com> | 2013-10-07 12:01:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-08 16:27:33 -0400 |
commit | fbf8866d65d5de84f75563eb0edd7fc27dbe9a90 (patch) | |
tree | 150188e64b62233edb22aefe9e57ed90196388da /net/ipv4/ip_sockglue.c | |
parent | 421b3885bf6d56391297844f43fb7154a6396e12 (diff) |
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>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 56e34457ac07..0626f2cb192e 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1052,11 +1052,12 @@ e_inval: | |||
1052 | * destination in skb->cb[] before dst drop. | 1052 | * destination in skb->cb[] before dst drop. |
1053 | * This way, receiver doesnt make cache line misses to read rtable. | 1053 | * This way, receiver doesnt make cache line misses to read rtable. |
1054 | */ | 1054 | */ |
1055 | void ipv4_pktinfo_prepare(struct sk_buff *skb) | 1055 | void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) |
1056 | { | 1056 | { |
1057 | struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); | 1057 | struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); |
1058 | 1058 | ||
1059 | if (skb_rtable(skb)) { | 1059 | if ((inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) && |
1060 | skb_rtable(skb)) { | ||
1060 | pktinfo->ipi_ifindex = inet_iif(skb); | 1061 | pktinfo->ipi_ifindex = inet_iif(skb); |
1061 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); | 1062 | pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); |
1062 | } else { | 1063 | } else { |