Skip to content

Commit a9d6532

Browse files
Eric Dumazetdavem330
authored andcommitted
ipv4: tcp: set SOCK_USE_WRITE_QUEUE for ip_send_unicast_reply()
TCP uses per cpu 'sockets' to send some packets : - RST packets ( tcp_v4_send_reset()) ) - ACK packets for SYN_RECV and TIMEWAIT sockets By setting SOCK_USE_WRITE_QUEUE flag, we tell sock_wfree() to not call sk_write_space() since these internal sockets do not care. This gives a small performance improvement, merely by allowing cpu to properly predict the sock_wfree() conditional branch, and avoiding one atomic operation. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9caad86 commit a9d6532

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,7 @@ static int __net_init tcp_sk_init(struct net *net)
23842384
IPPROTO_TCP, net);
23852385
if (res)
23862386
goto fail;
2387+
sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
23872388
*per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
23882389
}
23892390

0 commit comments

Comments
 (0)