From patchwork Fri May 8 12:31:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68D41C38A2A for ; Fri, 8 May 2020 12:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F0B621835 for ; Fri, 8 May 2020 12:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588941735; bh=Esc86zY99rb4tSwkuVMshuFgUhwa3CRmyeRGvkVGdrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AV92osffnzpHgnPwjsnhcq7vDtREWviNsAz/zC9uSUWP1y3e+MyQfis65lS0GbSTI WnwM3Z3pE7WcmzLFrlM8SYRi+nkuixwgrWZiyb7iQhxZvHF0pZKyDh3VqfSssNIhR2 zICePXWVw5MfUbykFSi1Naf/i/yMhDX3GqEc5i6U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728914AbgEHMmN (ORCPT ); Fri, 8 May 2020 08:42:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:38764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728911AbgEHMmL (ORCPT ); Fri, 8 May 2020 08:42:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F18CF21835; Fri, 8 May 2020 12:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588941731; bh=Esc86zY99rb4tSwkuVMshuFgUhwa3CRmyeRGvkVGdrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PnjCCbuQUoPKNYZFzoqi+N+kWQ+6bHE8IuQO9IsriumVYXe36X/1Ub4zWJYQ+cfPF Dcn5xopk1zYUfw/fKEXHT14kYUkJdlgsfMbyDvw+ZVmXxHN3USFnAUQIRKk6QUwUvC Nz/Uyk5Q4yTPYZl9Ljpcxwv658SaXmClybqzlEDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Neal Cardwell , Yuchung Cheng , "David S. Miller" Subject: [PATCH 4.4 111/312] tcp: do not set rtt_min to 1 Date: Fri, 8 May 2020 14:31:42 +0200 Message-Id: <20200508123132.294652218@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123124.574959822@linuxfoundation.org> References: <20200508123124.574959822@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet commit 372022830b06d9980c7e8b41fa0a4081cff883b0 upstream. There are some cases where rtt_us derives from deltas of jiffies, instead of using usec timestamps. Since we want to track minimal rtt, better to assume a delta of 0 jiffie might be in fact be very close to 1 jiffie. It is kind of sad jiffies_to_usecs(1) calls a function instead of simply using a constant. Fixes: f672258391b42 ("tcp: track min RTT using windowed min-filter") Signed-off-by: Eric Dumazet Signed-off-by: Neal Cardwell Cc: Yuchung Cheng Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2926,7 +2926,10 @@ static void tcp_update_rtt_min(struct so { const u32 now = tcp_time_stamp, wlen = sysctl_tcp_min_rtt_wlen * HZ; struct rtt_meas *m = tcp_sk(sk)->rtt_min; - struct rtt_meas rttm = { .rtt = (rtt_us ? : 1), .ts = now }; + struct rtt_meas rttm = { + .rtt = likely(rtt_us) ? rtt_us : jiffies_to_usecs(1), + .ts = now, + }; u32 elapsed; /* Check if the new measurement updates the 1st, 2nd, or 3rd choices */