From: Eric Dumazet Subject: [PATCH v2 net-next 3/4] tcp: make tcp_space() aware of socket backlog Date: Tue, 27 Nov 2018 07:57:37 -0800 Message-ID: <20181127155738.73068-4-edumazet@google.com> References: <20181127155738.73068-1-edumazet@google.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: netdev , Jean-Louis Dupond , Neal Cardwell , Yuchung Cheng , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pf1-f193.google.com ([209.85.210.193]:34879 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbeK1C4P (ORCPT ); Tue, 27 Nov 2018 21:56:15 -0500 Received: by mail-pf1-f193.google.com with SMTP id z9so8591921pfi.2 for ; Tue, 27 Nov 2018 07:57:54 -0800 (PST) In-Reply-To: <20181127155738.73068-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: Jean-Louis Dupond reported poor iscsi TCP receive performance that we tracked to backlog drops. Apparently we fail to send window updates reflecting the fact that we are under stress. Note that we might lack a proper window increase when backlog is fully processed, since __release_sock() clears sk->sk_backlog.len _after_ all skbs have been processed. This should not matter in practice. If we had a significant load through socket backlog, we are in a dangerous situation. Reported-by: Jean-Louis Dupond Signed-off-by: Eric Dumazet --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 0c61bf0a06dac95268c26b6302a2afbaef4c88b3..3b522259da7d5a54d7d3730ddd8d8c9ef24313e1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1368,7 +1368,7 @@ static inline int tcp_win_from_space(const struct sock *sk, int space) /* Note: caller must be prepared to deal with negative returns */ static inline int tcp_space(const struct sock *sk) { - return tcp_win_from_space(sk, sk->sk_rcvbuf - + return tcp_win_from_space(sk, sk->sk_rcvbuf - sk->sk_backlog.len - atomic_read(&sk->sk_rmem_alloc)); } -- 2.20.0.rc0.387.gc7a69e6b6c-goog