Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp467476ybl; Tue, 28 Jan 2020 06:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzAmNJvRekKZfMb53pSuOzZtcVvrPv2ebfNf5r0Ny0Qv7vXFkYtqGZkTdcPLKZ3DerONJ1Q X-Received: by 2002:a05:6830:2154:: with SMTP id r20mr10509633otd.131.1580221547566; Tue, 28 Jan 2020 06:25:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221547; cv=none; d=google.com; s=arc-20160816; b=qHemyjY4WwVIOY7MJF9++/hURPH6WTbjF6CgdQGnXv7PtKbMa8Cf9uEHGGjISmmsH4 3FOP9OMxTxy2eXTTe+v2flWvxmx7pkfkI6VqekWYRjKZkZfudLegujJicTvwg37pjOG0 wPSpk0UlkDMvp9qNL1Fdr5u2RBfZ8r8RPPfc1VRH9mYsrOwpiRbPAXwdBXkbzEofFtE7 2u57lhnuUptBIEmaD8tkcqfco9zXAyunuyeITAApY8ErLEnQPNwDQHjJJTfn15t/SmVX oTN+VFfKXQjvq2DQfaXSbTCIRRLGw+hUYB4QY4ZONk6pPGtexiQQ9hc6CurflcSTf5RS AvFA== 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=MAgkf7FznyyxlDJtgUdX2pVB5LPQW/doOOf65QmAlIM=; b=BMGlq0q80bZ4lzUghVz0tMmn203KOlc8flRsLeQQhUglFJ3YJyfZMOpcusb00GBz6E 4KXRb2rq7uvG6EBcJb3uJfFVSQ01OsSyssy4uz/FwUku8wSyRKuhNi4K1rQBukkIRiMH etA/1z7EzCEiEz55AB8aJrZ6k3zDle2s48Pf827OQMvw0Z8SrEr9vIIrX7Q6B1JmUX6z xDBMDJpdtXYcBckWKRs8Cd+Do9ZY/IIogdUj0AAs5G5zefzq+JApqTCcWNhoW0pcPsdi SnH05SSb8MzmBrr2cEwDQiYIVmRELDpCHWE4t0Sjvz3J6d+w/CJesFdnYXJPT9/nxOP2 i+8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Smh+A9SJ; 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 l140si2293736oib.114.2020.01.28.06.25.36; Tue, 28 Jan 2020 06:25:47 -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=Smh+A9SJ; 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 S1732675AbgA1OYi (ORCPT + 99 others); Tue, 28 Jan 2020 09:24:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:51356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732572AbgA1OYg (ORCPT ); Tue, 28 Jan 2020 09:24:36 -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 AEA112071E; Tue, 28 Jan 2020 14:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221475; bh=BDZEEsBK6AX+caJfyrsZPuxiKlFI9f3B0vVgXc6IL9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Smh+A9SJPuEjbWKEXever5gBTmQObmvfu9X1luRMrz8v/okNnKUAJfsG+isgKUXlz iH9s+i1/K4vKqw8kQwa/kieTxe3EYxoKSzQxSrkHo3LbybdPUY3lwGoC5kVcHfTC12 RGlIhaj8j91Jr6bkGOmIj591XL94filWx2ONahyg= 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.9 240/271] tcp_bbr: improve arithmetic division in bbr_update_bw() Date: Tue, 28 Jan 2020 15:06:29 +0100 Message-Id: <20200128135910.406657627@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@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 @@ -649,8 +649,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