From patchwork Fri Jan 17 21:37:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahdi Arghavani X-Patchwork-Id: 13944010 X-Patchwork-Delegate: kuba@kernel.org Received: from sonic308-2.consmr.mail.bf2.yahoo.com (sonic308-2.consmr.mail.bf2.yahoo.com [74.6.130.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0204B1A9B5C for ; Fri, 17 Jan 2025 22:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.6.130.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737151713; cv=none; b=UV4eCDnM4A0hLS21dY3pou7ZmKQZTPNc2hSvWDreSgn8CgIh4H+5Ymvx9THXZoO6huHL54JB6YRohKk1fEYloYNhhsqRydTddyvDUVTBVpLBqrD9uUdy23EQ4DgSMB9VUNIieFCsvt2XGFSLP8SYOwF6YdHQ8ZenC67p6SR25dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737151713; c=relaxed/simple; bh=kkyJpN2H8f20qQxk/PKUdwzdlkTFXqkJ4LLKWy+l3gE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:References; b=sJNncF5Gx515KTZFbIz0e8o8AxW3WiK6/KzRiBcBs1np0s+UIykq+TmeVAV5Zm+RF6WmLY8pJ5P3CP66AnGfgA/h3/VkXPNzYzpp9h+/pi0LJNxU4zFSURgHrazpTeUb2hnCNzOj+SW/b902j6F3k+GOMdby2sqtBklZKFlRsD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=QTG2Hu+D; arc=none smtp.client-ip=74.6.130.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="QTG2Hu+D" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737151710; bh=UA83hC/G4Of1hbLyj+LRwSJ/EKvVgrTXzPyDrvhG2+g=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=QTG2Hu+DkkxZnUWFW0ELYk9dPSiePXV5d/+CB7NnRsB8S/zgbF5aMhG/WnuDPPArqZTAXYOHW2+4I3TOqll/7iWnIazWGySWkfVhgpksORS6qal0OYbnT01itTQt20ZVr1BKgW049j+PLryQ44g7AjME5gMhOE6+GJLmWSKV0RxGeFYi3ndHXUFQZ+Pi8tVqtjH3wCRrMKeM24bkKHHW8fk1kDG7DogImNrSHDCLB96tL/ksL17nT3w6+gwdyNCsyDZDSR2y6YNq4f0vG0HILuxCKjoZYeG3qw/1VxID9sziT24gPzIbJ9luEO2mpkx2jyIoUAMfbe3uNrF531hVwg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737151710; bh=kHF1Kxmi1SQTEC6hFA4jIew2kM0/HkP+++mUjsRKA1j=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=ZI95PnsGeSXo6n6y8e7GPwropNBqcEFxHrGWdFL2/qSEfTEBZx60N7o+RnRsXQdIn/2a8qDJEyxDO45m3smz4me4/EGUymE6q2Zxv2+VcTP3Zl0okdh65mjqT1xvSrGB2VBCLJ6+bLgKH3lVblWNI49wRqY4G5ekT9pGrJdrOShaKQA7nCkAjzpCQYVhJ5HYirV8CSA+B408t9b7G5T5rDFFRlVcI81qezrBJu/CCXdcoJvTj1OWZapNI3EuPAbJp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Z3uBvFst sq66S2W_t_nW43OK6_SSvAxiiqDcTEkSm9XfimErwmIZPzfBmDhmLFEiGAQRD9X9Ddj9AIQMDL0v bF_pWEVwNnNDjELBFlcCvmPQCGkVXyfSD6oo6kQcgrkyN5AbqDvVKmBZain.zDC.HrJ86e09es6m B_SSxZevMk4InCWHCCn.Weo.TETfvzSzBWiAXHAn.iJ3C63KsSqe9PhrLR_bTwqTT9ch4cNDV1SQ xkUCBZqQwbHRTxQ6DU2FWeJh2IwuGqEf8SbVzc3m.lRBF4mZpPOZSVS5bIlLYnA01Pw-- X-Sonic-MF: X-Sonic-ID: c0853c38-5a01-4c1b-b29e-0e25507b8384 Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Fri, 17 Jan 2025 22:08:30 +0000 Received: by hermes--production-gq1-5dd4b47f46-pfhh2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID faeef59307ebb752fac77bc703b94179; Fri, 17 Jan 2025 21:38:06 +0000 (UTC) From: Mahdi Arghavani To: netdev@vger.kernel.org Cc: ncardwell@google.com, edumazet@google.com, haibo.zhang@otago.ac.nz, david.eyers@otago.ac.nz, abbas.arghavani@mdu.se, Mahdi Arghavani , Jason Xing Subject: [PATCH net v3] tcp_cubic: fix incorrect HyStart round start detection Date: Fri, 17 Jan 2025 21:37:51 +0000 Message-ID: <20250117213751.2404-1-ma.arghavani@yahoo.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250117213751.2404-1-ma.arghavani.ref@yahoo.com> X-Patchwork-Delegate: kuba@kernel.org I noticed that HyStart incorrectly marks the start of rounds, leading to inaccurate measurements of ACK train lengths and resetting the `ca->sample_cnt` variable. This inaccuracy can impact HyStart's functionality in terminating exponential cwnd growth during Slow-Start, potentially degrading TCP performance. The issue arises because the changes introduced in commit 4e1fddc98d25 ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") moved the caller of the `bictcp_hystart_reset` function inside the `hystart_update` function. This modification added an additional condition for triggering the caller, requiring that (tcp_snd_cwnd(tp) >= hystart_low_window) must also be satisfied before invoking `bictcp_hystart_reset`. This fix ensures that `bictcp_hystart_reset` is correctly called at the start of a new round, regardless of the congestion window size. This is achieved by moving the condition (tcp_snd_cwnd(tp) >= hystart_low_window) from before calling `bictcp_hystart_reset` to after it. I tested with a client and a server connected through two Linux software routers. In this setup, the minimum RTT was 150 ms, the bottleneck bandwidth was 50 Mbps, and the bottleneck buffer size was 1 BDP, calculated as (50M / 1514 / 8) * 0.150 = 619 packets. I conducted the test twice, transferring data from the server to the client for 1.5 seconds. Before the patch was applied, HYSTART-DELAY stopped the exponential growth of cwnd when cwnd = 516, and the bottleneck link was not yet saturated (516 < 619). After the patch was applied, HYSTART-ACK-TRAIN stopped the exponential growth of cwnd when cwnd = 632, and the bottleneck link was saturated (632 > 619). In this test, applying the patch resulted in 300 KB more data delivered. Fixes: 4e1fddc98d25 ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") Signed-off-by: Mahdi Arghavani Reviewed-by: Jason Xing Cc: Neal Cardwell Cc: Eric Dumazet Cc: Haibo Zhang Cc: David Eyers Cc: Abbas Arghavani Reviewed-by: Neal Cardwell Tested-by: Neal Cardwell --- net/ipv4/tcp_cubic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 5dbed91c6178..76c23675ae50 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -392,6 +392,10 @@ static void hystart_update(struct sock *sk, u32 delay) if (after(tp->snd_una, ca->end_seq)) bictcp_hystart_reset(sk); + /* hystart triggers when cwnd is larger than some threshold */ + if (tcp_snd_cwnd(tp) < hystart_low_window) + return; + if (hystart_detect & HYSTART_ACK_TRAIN) { u32 now = bictcp_clock_us(sk); @@ -467,9 +471,7 @@ __bpf_kfunc static void cubictcp_acked(struct sock *sk, const struct ack_sample if (ca->delay_min == 0 || ca->delay_min > delay) ca->delay_min = delay; - /* hystart triggers when cwnd is larger than some threshold */ - if (!ca->found && tcp_in_slow_start(tp) && hystart && - tcp_snd_cwnd(tp) >= hystart_low_window) + if (!ca->found && tcp_in_slow_start(tp) && hystart) hystart_update(sk, delay); }