Skip to content

Commit b3a5b6c

Browse files
Eric Dumazetdavem330
authored andcommitted
icmp: No need to call sk_write_space()
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a9828ec commit b3a5b6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv4/icmp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,10 @@ static int __net_init icmp_sk_init(struct net *net)
11651165
sk->sk_sndbuf =
11661166
(2 * ((64 * 1024) + sizeof(struct sk_buff)));
11671167

1168+
/*
1169+
* Speedup sock_wfree()
1170+
*/
1171+
sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
11681172
inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT;
11691173
}
11701174

0 commit comments

Comments
 (0)