From: Eric Dumazet Subject: [PATCH v3 net-next 3/4] tcp: make tcp_space() aware of socket backlog Date: Tue, 27 Nov 2018 14:42:02 -0800 Message-ID: <20181127224203.69999-4-edumazet@google.com> References: <20181127224203.69999-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-pl1-f193.google.com ([209.85.214.193]:32982 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbeK1Jlp (ORCPT ); Wed, 28 Nov 2018 04:41:45 -0500 Received: by mail-pl1-f193.google.com with SMTP id z23so16335970plo.0 for ; Tue, 27 Nov 2018 14:42:21 -0800 (PST) In-Reply-To: <20181127224203.69999-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 Acked-by: Neal Cardwell Acked-by: Yuchung Cheng --- 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