From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Brakmo Subject: [PATCH net-next v3 2/2] tcp: ack immediately when a cwr packet arrives Date: Tue, 3 Jul 2018 09:26:15 -0700 Message-ID: <20180703162615.314231-3-brakmo@fb.com> References: <20180703162615.314231-1-brakmo@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Kernel Team , Blake Matheny , Alexei Starovoitov , Neal Cardwell , Yuchung Cheng , Steve Ibanez , Eric Dumazet To: netdev Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:57614 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932520AbeGCQ0V (ORCPT ); Tue, 3 Jul 2018 12:26:21 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w63GOZkd003580 for ; Tue, 3 Jul 2018 09:26:20 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2k0ar7rdh1-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 03 Jul 2018 09:26:20 -0700 In-Reply-To: <20180703162615.314231-1-brakmo@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: We observed high 99 and 99.9% latencies when doing RPCs with DCTCP. The problem is triggered when the last packet of a request arrives CE marked. The reply will carry the ECE mark causing TCP to shrink its cwnd to 1 (because there are no packets in flight). When the 1st packet of the next request arrives, the ACK was sometimes delayed even though it is CWR marked, adding up to 40ms to the RPC latency. This patch insures that CWR makred data packets arriving will be acked immediately. Modified based on comments by Neal Cardwell Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2c5d70bc294e..23c2a43de8a4 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -246,8 +246,15 @@ static void tcp_ecn_queue_cwr(struct tcp_sock *tp) static void tcp_ecn_accept_cwr(struct tcp_sock *tp, const struct sk_buff *skb) { - if (tcp_hdr(skb)->cwr) + if (tcp_hdr(skb)->cwr) { tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; + + /* If the sender is telling us it has entered CWR, then its + * cwnd may be very low (even just 1 packet), so we should ACK + * immediately. + */ + tcp_enter_quickack_mode((struct sock *)tp, 2); + } } static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) -- 2.17.1