summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-15 22:02:40 +0300
committerDavid S. Miller <davem@davemloft.net>2021-11-16 16:10:34 +0300
commit93afcfd1db35882921b2521a637c78755c27b02c (patch)
treee5bd0dd1290a879e31023cef54113e98fb876611 /net/ipv4
parent91b6d325635617540b6a1646ddb138bb17cbd569 (diff)
downloadlinux-93afcfd1db35882921b2521a637c78755c27b02c.tar.xz
tcp: small optimization in tcp recvmsg()
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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 862e8cb8dda5..24d77a32c9cb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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);
}