[PATCH mptcp-next v9 3/9] tcp: drop release and lock again in splice_read

Geliang Tang posted 9 patches 2 months ago
There is a newer version of this series
[PATCH mptcp-next v9 3/9] tcp: drop release and lock again in splice_read
Posted by Geliang Tang 2 months ago
From: Geliang Tang <tanggeliang@kylinos.cn>

In the main loop of tcp_splice_read(), release_sock() is invoked to release
the socket lock, and then lock_sock() is immediately invoked to hold the
socket lock again.

It looks like these two calls are useless, so let's drop them.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/ipv4/tcp.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 5aafe569d4d0..c81866ec4333 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -866,8 +866,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
 
 		if (!tss.len || !timeo)
 			break;
-		release_sock(sk);
-		lock_sock(sk);
 
 		if (sk->sk_err || sk->sk_state == TCP_CLOSE ||
 		    (sk->sk_shutdown & RCV_SHUTDOWN) ||
-- 
2.48.1