]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tcp: small optimization in tcp recvmsg()
authorEric Dumazet <edumazet@google.com>
Mon, 15 Nov 2021 19:02:40 +0000 (11:02 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Nov 2021 13:10:34 +0000 (13:10 +0000)
When reading large chunks of data, incoming packets might
be added to the backlog from BH.

tcp recvmsg() detects the backlog queue is not empty, and uses
a release_sock()/lock_sock() pair to process this backlog.

We now have __sk_flush_backlog() to perform this
a bit faster.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c

index 862e8cb8dda51e76300a427783a7d8c32e82cc7f..24d77a32c9cbcdf0e4380ec6d9aa3e42d2cf8730 100644 (file)
@@ -2409,8 +2409,7 @@ static int tcp_recvmsg_locked(struct sock *sk, struct msghdr *msg, size_t len,
 
                if (copied >= target) {
                        /* Do not sleep, just process backlog. */
-                       release_sock(sk);
-                       lock_sock(sk);
+                       __sk_flush_backlog(sk);
                } else {
                        sk_wait_data(sk, &timeo, last);
                }