From: Eric Dumazet edumazet@google.com
mainline inclusion from mainline-v5.17-rc1 commit 93afcfd1db35882921b2521a637c78755c27b02c category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I65HYE
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
---------------------------
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 (cherry picked from commit 93afcfd1db35882921b2521a637c78755c27b02c) Signed-off-by: Liu Jian liujian56@huawei.com --- net/ipv4/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ca6b15148fecd..81693b83a8515 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2246,8 +2246,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
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); }