Skip to content

Commit

Permalink
net: avoid a pair of dst_hold()/dst_release() in ip_push_pending_fram…
Browse files Browse the repository at this point in the history
…es()

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: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 25, 2008
1 parent 2e77d89 commit a21bba9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,12 @@ int ip_push_pending_frames(struct sock *sk)

skb->priority = sk->sk_priority;
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)
icmp_out_count(net, ((struct icmphdr *)
Expand Down

0 comments on commit a21bba9

Please sign in to comment.