diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-11-24 19:07:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-24 19:07:50 -0500 |
commit | a21bba945430f3f5e00c349665f88cdacdb32a8d (patch) | |
tree | 9ff6a910b16925d2ee3c02b7221f3984ad5cd949 /net/ipv4/ip_output.c | |
parent | 2e77d89b2fa8e3f8325b8ce7893ec3645f41aff5 (diff) |
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: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 5516825a0751..8ebe86dd72af 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1284,7 +1284,12 @@ int ip_push_pending_frames(struct sock *sk) | |||
1284 | 1284 | ||
1285 | skb->priority = sk->sk_priority; | 1285 | skb->priority = sk->sk_priority; |
1286 | skb->mark = sk->sk_mark; | 1286 | skb->mark = sk->sk_mark; |
1287 | skb->dst = dst_clone(&rt->u.dst); | 1287 | /* |
1288 | * Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec | ||
1289 | * on dst refcount | ||
1290 | */ | ||
1291 | inet->cork.dst = NULL; | ||
1292 | skb->dst = &rt->u.dst; | ||
1288 | 1293 | ||
1289 | if (iph->protocol == IPPROTO_ICMP) | 1294 | if (iph->protocol == IPPROTO_ICMP) |
1290 | icmp_out_count(net, ((struct icmphdr *) | 1295 | icmp_out_count(net, ((struct icmphdr *) |