Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp436747ybl; Tue, 28 Jan 2020 06:01:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwI1iYbhNu5EEEI/aavNskxoZM/mFO6Qe6z/tfK65SvX9EJX8cCJRiOIxdGNx+NtWgLU/ZU X-Received: by 2002:a9d:7b51:: with SMTP id f17mr16116230oto.302.1580220060783; Tue, 28 Jan 2020 06:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580220060; cv=none; d=google.com; s=arc-20160816; b=RZf+wuvQxjC9Q2WKSfYxVpM0tT89hCVik+rRyCczV1vbR/Gf3w48DC4Y68a58GfJEo CE9jHkYQXDYrGwhaZha0Zsxo8AutW6SLbkp6BKc0BWB922PXnIBMhkarE7bM4MbCpi1X f+jjVFcxMmXaRD8z2YWNw+Q1WeXDedWY92fDwDEdoiPFbh5HftWbfPn0FruBdpw+Wu0J 3yAgEQVbLmLDCLXX2QrC0LASFTv/o+nPbHfHCldovcgnmgFDsUMPaGsofzHCGayGXmEL FFf4QkUTAjzblgB00S+rlkUAqf10H/n86EOhZ+8ZsgWFSqahOjaLZEh0BmAV0CwvOgZa qHjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nJlByUMw8uorYTpvHGRcTcE3S7NlQg9RFkAnuZ+XNf4=; b=sODaMgfyCDf1EyrJXVFeoEJzPFgvyUFUQSEF1PCLKzjXDqI8+qzi0BqqjABq47Enx7 56850/pWH9b0/qooVQY6/eEjq97+KxQiiMDNW08Q5lSI2/lNvx3saNn1xE064xAaByl/ x0Z26LD0b1w7M6zyZJhX80+IGoDccgbCQjFxSrcr1VkxFLcRnBdovfTaEveL4ibLSfmY J0+buNtwnOn4LAKkcI2NMAEHM4ssPWLaayiyesNNVtwg8vLa+r/nwEIqRsJVtPCeHsuY Ey0iKaWwW/s+9w5NoAlcc4jbMbFe99CJzs3yHywMyDu2/mX23akZi4HooEI6+z1Y0RKp vmtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="NJGF/wPj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si7553660otl.17.2020.01.28.06.00.48; Tue, 28 Jan 2020 06:01:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="NJGF/wPj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726909AbgA1N71 (ORCPT + 99 others); Tue, 28 Jan 2020 08:59:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:44796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgA1N7Z (ORCPT ); Tue, 28 Jan 2020 08:59:25 -0500 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 E065024685; Tue, 28 Jan 2020 13:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580219965; bh=zZf8c5U7fLLNQMm+qitPFQ+bq0WSO61rPIjPlrn69Mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJGF/wPjJWvRs4xJAWSV1B9VkEdMIigmUcDAwjtJJxvfJvBpYjQJzEPY4vVkLdV5H fDOQ6bucQXkrxIBI2MYNzJr2SRuc63E36rjXUY7UK7sowCW/V0ouZHXO7IBqxkQez4 hLWc00mexKh/R4mULMeLk9M9GHaqKZpkWrotXAtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , Eric Dumazet , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org Subject: [PATCH 4.14 15/46] tcp_bbr: improve arithmetic division in bbr_update_bw() Date: Tue, 28 Jan 2020 14:57:49 +0100 Message-Id: <20200128135751.969497560@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135749.822297911@linuxfoundation.org> References: <20200128135749.822297911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang [ Upstream commit 5b2f1f3070b6447b76174ea8bfb7390dc6253ebd ] do_div() does a 64-by-32 division. Use div64_long() instead of it if the divisor is long, to avoid truncation to 32-bit. And as a nice side effect also cleans up the function a bit. Signed-off-by: Wen Yang Cc: Eric Dumazet Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: Hideaki YOSHIFUJI Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_bbr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -678,8 +678,7 @@ static void bbr_update_bw(struct sock *s * bandwidth sample. Delivered is in packets and interval_us in uS and * ratio will be <<1 for most connections. So delivered is first scaled. */ - bw = (u64)rs->delivered * BW_UNIT; - do_div(bw, rs->interval_us); + bw = div64_long((u64)rs->delivered * BW_UNIT, rs->interval_us); /* If this sample is application-limited, it is likely to have a very * low delivered count that represents application behavior rather than