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=-16.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 5325EC43381 for ; Fri, 22 Mar 2019 13:26:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2153221916 for ; Fri, 22 Mar 2019 13:26:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WEr65TPZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728298AbfCVN0f (ORCPT ); Fri, 22 Mar 2019 09:26:35 -0400 Received: from mail-ua1-f73.google.com ([209.85.222.73]:47455 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728181AbfCVN0e (ORCPT ); Fri, 22 Mar 2019 09:26:34 -0400 Received: by mail-ua1-f73.google.com with SMTP id 63so163822uat.14 for ; Fri, 22 Mar 2019 06:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=QGzyABsYxtdtozlz+Rad+y9X1mLohpGKsJSXQpjXcrE=; b=WEr65TPZvJaGLTUlnK5d5G/WGTyAqEF2Ucb+W+TpJApjacrImLZ8YcMbuAmm104Rt4 zlg/1CkcMRGs5/3QypYZb06H956HZMz/oMtsPDCYl7JqZFuCa1Z07rbKAY7HvmvlkKmm my+Edfg1oLuCcXXhehEjGN4MzMTf3BQf7KtEPLEGy+3dhLbwIYBmA1iVx0u1F2/shPP0 FAXxnGCcQ/4/qsYpAa28ghm9ghepepYJlQLzR7plu8kkfZ3TKXQfgFwMZ4o5SlXLRStp sTFsYbwMKeVHmq63vO+6iAKUnDN3UMJDgfeS22l5+gpqNpPj3AltEwFTk3gmh27P+fN1 ZeNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=QGzyABsYxtdtozlz+Rad+y9X1mLohpGKsJSXQpjXcrE=; b=GNW9u8+1+9xv5lFWaD1vnxP5TmFj1dTT1fq2nVBvF1LoMEGBwGgQQBW9xulOcYphb7 I2dmk6saxF7ckzyHhstrsIMrViHz/FmM6IAErUj1L/RofZw1jj915BqVlbRejztmzgwE N2fJpl154EnmddQIF5SSvpsdWzBCsmmOE2ZVGX3672sdZUU4eUAKks/mRKkRZ6wbnO+N OGXUhdQiNziISku9cc34+3+IWVMKe00qOfmS6P4oRsEuijmaFDl/KR/YFNfS7RXeurkm EIPWYM67boLwe8skzTCE0fXcYa2UA5YTTh4zq0SAN92zQhXM2MiUoJxKBHnJrvfOBpYt /lww== X-Gm-Message-State: APjAAAVF3suArpumEgyVaCmpTlQjWi1D4yOIYM6tMoGZw7dJztUTKZIE vGXrp8GKmcylkmezc6Zm+OypBEmShj/h3w== X-Google-Smtp-Source: APXvYqz8ZGvra6pl6mpl5ZiFHBF6ROJvcr8d92t6Pm+iZFAosyKUCMMPCyWJsfi8Vj7+yYHaWisVEI7nyKzi4A== X-Received: by 2002:a67:bd01:: with SMTP id y1mr5590090vsq.167.1553261193846; Fri, 22 Mar 2019 06:26:33 -0700 (PDT) Date: Fri, 22 Mar 2019 06:26:29 -0700 Message-Id: <20190322132629.158360-1-edumazet@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH net-next] tcp: remove conditional branches from tcp_mstamp_refresh() From: Eric Dumazet To: "David S . Miller" Cc: netdev , Eric Dumazet , Eric Dumazet Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tcp_clock_ns() (aka ktime_get_ns()) is using monotonic clock, so the checks we had in tcp_mstamp_refresh() are no longer relevant. This patch removes cpu stall (when the cache line is not hot) Signed-off-by: Eric Dumazet --- net/ipv4/tcp_output.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 4522579aaca2d24b7be61abac658a3c8cbd2b960..e265d1aeeb66996da3903eef383eaec9a320cce0 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -52,12 +52,8 @@ void tcp_mstamp_refresh(struct tcp_sock *tp) { u64 val = tcp_clock_ns(); - if (val > tp->tcp_clock_cache) - tp->tcp_clock_cache = val; - - val = div_u64(val, NSEC_PER_USEC); - if (val > tp->tcp_mstamp) - tp->tcp_mstamp = val; + tp->tcp_clock_cache = val; + tp->tcp_mstamp = div_u64(val, NSEC_PER_USEC); } static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, -- 2.21.0.392.gf8f6787159e-goog