From patchwork Wed Jan 15 01:04:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahdi Arghavani X-Patchwork-Id: 13939718 X-Patchwork-Delegate: kuba@kernel.org Received: from sonic313-15.consmr.mail.bf2.yahoo.com (sonic313-15.consmr.mail.bf2.yahoo.com [74.6.133.125]) (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 7F62D1798F for ; Wed, 15 Jan 2025 01:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.6.133.125 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736904363; cv=none; b=Awyzox8RSbtr6LRTFmOM5nY4dMo3Ve4amBSMtnpj5yjh3FlBvMv5YcCgOKMELtdhLDhfa4o1KbVj4FqdXjgvCZBUBiTDmSCY1ZUjWzH88eNMtj+F/FZlzKY4HWLkDKlvkUg4YE3XrYoM/CBjH/esf+FdW3LzgtPZXHE7nDuTVhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736904363; c=relaxed/simple; bh=J596zsZH8nthlDPy8sIPEYZu/ulpgCY7xmtl/nTb4CY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:References; b=MtWqGnqT8nLSMxc233BOoccS3apvmsySN1DwVhxgtmrttRuLsCC4jX7TgDIV4tMXyUDgatEGRWugHuNyDititZlIPYgbwbQpTmTtqtnbQOvwD9lUTk69zJQCAGJlAud4scdAhPKcyyDqkyDbZXl1JyLC0lm+aGbyaFMJUmYG10A= 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=LTa8Bo1y; arc=none smtp.client-ip=74.6.133.125 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="LTa8Bo1y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1736904360; bh=WhmMp4DtkoCndYSZG6Zsl0jQwRCj7Qq7I81RrO15sng=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=LTa8Bo1yn518e/RFTKce7AIw7AnAOpdojm9kKWmzBLryf1QQX00pztAg7Kzn0QTvpdeu92PI9RW+gPp6DjowOeGn2SNvqT4NyxwaGjQGiBxYchsWUzO4oq5Ew1HImBehZsIjnfeixmttpdqk0dCk/H27v4740zYj+O3DmbeCZ0cQ6Ru58mPBLqcgT3RM0MHOdW00JxuqtxMp663InencFvauczsxAbSMPOUQBA8bP0vDimHaLhjiE1LWEx8N7kA6SV1UL/Nme1RSqKKtsVVpXSY5p6n0C5Z1kJJ4UALnTJmOWDbnchjXNs+kQSQxra4EYJ4dvzTMftprX0HCp3QUkQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1736904360; bh=OKkDey0IY7326fSuv0DGnUuptk+MDBBfCJEsnoknCzz=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=PHz0B93Kwgc0pg4IoZq4buWOaIyfoxKFSHXSzCtzB+cZvSUGbDeh1SW+g1xnZJz0gDrzwQYpiy6cKAfmmfy2kSwzhUAz/bZJgxPnxdk7t69SjU4HshjmrdOz1++M8yEfQhrzL9vOstvh0WrtnyA2dI3nPzB48rVEJeoroNYb3SCJgg1/hMMDa0OwQ7r4/+Nz2kV7EkAIO1Of+HISbUoBzTko2VrPDTPT+vK4UUdmmMIz8U/g8uBff7g/peRcC8MeiOPvx1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ITEhhyVfsgzyZyercnRvIhZd4CbvEGyZCxhRShLBh pqudvQ0z7btCEdIyaY0SpmbgNQ5vLxpyDPR.BRVZHDJuUGWECvVDUcTPXldI7HXE_5qmPMHFZ7an TYBv8F0ylp5dz6Zd6h1o.qfRv4k09sJAmW0fAonAtV6eO5Cl11jJSmwLubOnw9d2yw1YhMYzjEfD 8MF8ByCe2zeewgZFdemFfK8f05JLaGsMi6hMi.8N9SKwqGhbQJSQ3ddoB_DSj X-Sonic-MF: X-Sonic-ID: fb8b9fa5-10a8-46f4-a9f6-de356fe3ed47 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Wed, 15 Jan 2025 01:26:00 +0000 Received: by hermes--production-gq1-5dd4b47f46-9j75b (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID d04c840b748146b98f8b7c39c5959005; Wed, 15 Jan 2025 01:05:42 +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 Subject: [PATCH net v2] tcp_cubic: fix incorrect HyStart round start detection Date: Wed, 15 Jan 2025 01:04:50 +0000 Message-ID: <20250115010450.2472-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: <20250115010450.2472-1-ma.arghavani.ref@yahoo.com> X-Patchwork-Delegate: kuba@kernel.org I noticed that HyStart incorrectly marks the start of rounds, resulting in inaccurate measurements of ACK train lengths. Since HyStart relies on ACK train lengths as one of two thresholds to terminate exponential cwnd growth during Slow-Start, this inaccuracy renders that threshold ineffective, 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. Fixes: 4e1fddc98d25 ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") Signed-off-by: Mahdi Arghavani Cc: Neal Cardwell Cc: Eric Dumazet Cc: Haibo Zhang Cc: David Eyers Cc: Abbas Arghavani --- 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); }