Commit a21bba94 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: avoid a pair of dst_hold()/dst_release() in ip_push_pending_frames()

We can reduce pressure on dst entry refcount that slowdown UDP transmit
path on SMP machines. This pressure is visible on RTP servers when
delivering content to mediagateways, especially big ones, handling
thousand of streams. Several cpus send UDP frames to the same
destination, hence use the same dst entry.

This patch makes ip_push_pending_frames() steal the refcount its
callers had to take when filling inet->cork.dst.

This doesnt avoid all refcounting, but still gives speedups on SMP,
on UDP/RAW transmit path.
Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e77d89b
...@@ -1284,7 +1284,12 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1284,7 +1284,12 @@ int ip_push_pending_frames(struct sock *sk)
skb->priority = sk->sk_priority; skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark; skb->mark = sk->sk_mark;
skb->dst = dst_clone(&rt->u.dst); /*
* Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec
* on dst refcount
*/
inet->cork.dst = NULL;
skb->dst = &rt->u.dst;
if (iph->protocol == IPPROTO_ICMP) if (iph->protocol == IPPROTO_ICMP)
icmp_out_count(net, ((struct icmphdr *) icmp_out_count(net, ((struct icmphdr *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment