netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] icmp: No need to call sk_write_space()
@ 2009-09-24 22:16 Eric Dumazet
  2009-10-05  7:12 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2009-09-24 22:16 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

We can make icmp messages tx completion callback a litle bit faster.

Setting SOCK_USE_WRITE_QUEUE sk flag tells sock_wfree() to
not call sk_write_space() on a socket we know no thread is posssibly
waiting for write space. (on per cpu kernel internal icmp sockets only)

This avoids the sock_def_write_space() call and 
read_lock(&sk->sk_callback_lock)/read_unlock(&sk->sk_callback_lock) calls
as well.

We avoid three atomic ops.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 5bc13fe..84adb57 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1165,6 +1165,10 @@ static int __net_init icmp_sk_init(struct net *net)
 		sk->sk_sndbuf =
 			(2 * ((64 * 1024) + sizeof(struct sk_buff)));
 
+		/*
+		 * Speedup sock_wfree()
+		 */
+		sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
 		inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT;
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] icmp: No need to call sk_write_space()
  2009-09-24 22:16 [PATCH] icmp: No need to call sk_write_space() Eric Dumazet
@ 2009-10-05  7:12 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-10-05  7:12 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 25 Sep 2009 00:16:51 +0200

> We can make icmp messages tx completion callback a litle bit faster.
> 
> Setting SOCK_USE_WRITE_QUEUE sk flag tells sock_wfree() to
> not call sk_write_space() on a socket we know no thread is posssibly
> waiting for write space. (on per cpu kernel internal icmp sockets only)
> 
> This avoids the sock_def_write_space() call and 
> read_lock(&sk->sk_callback_lock)/read_unlock(&sk->sk_callback_lock) calls
> as well.
> 
> We avoid three atomic ops.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-05  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24 22:16 [PATCH] icmp: No need to call sk_write_space() Eric Dumazet
2009-10-05  7:12 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).