From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,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 CA7EFC3276C for ; Thu, 2 Jan 2020 08:15:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 903AD21734 for ; Thu, 2 Jan 2020 08:15:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 903AD21734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3FB328E0007; Thu, 2 Jan 2020 03:15:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AAA78E0003; Thu, 2 Jan 2020 03:15:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E9358E0007; Thu, 2 Jan 2020 03:15:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 13AA38E0003 for ; Thu, 2 Jan 2020 03:15:27 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id BE7012C68 for ; Thu, 2 Jan 2020 08:15:26 +0000 (UTC) X-FDA: 76331984652.23.root93_8696971ba065f X-HE-Tag: root93_8696971ba065f X-Filterd-Recvd-Size: 2834 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jan 2020 08:15:24 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0TmanhFc_1577952914; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TmanhFc_1577952914) by smtp.aliyun-inc.com(127.0.0.1); Thu, 02 Jan 2020 16:15:21 +0800 From: Wen Yang To: Andrew Morton , Qian Cai Cc: xlpang@linux.alibaba.com, Wen Yang , Tejun Heo , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm/page-writeback.c: use div64_ul() for u64-by-unsigned-long divide Date: Thu, 2 Jan 2020 16:14:41 +0800 Message-Id: <20200102081442.8273-3-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200102081442.8273-1-wenyang@linux.alibaba.com> References: <20200102081442.8273-1-wenyang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The two variables 'numerator' and 'denominator', though they are declared as long, they should actually be unsigned long (according to the implementation of the fprop_fraction_percpu() function) And do_div() does a 64-by-32 division, while the divisor 'denominator' is unsigned long, thus 64-bit on 64-bit platforms. Hence the proper function to call is div64_ul(). Signed-off-by: Wen Yang Cc: Andrew Morton Cc: Qian Cai Cc: Tejun Heo Cc: Jens Axboe Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/page-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 2d658b2..c74c6bd 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -766,7 +766,7 @@ static unsigned long __wb_calc_thresh(struct dirty_th= rottle_control *dtc) struct wb_domain *dom =3D dtc_dom(dtc); unsigned long thresh =3D dtc->thresh; u64 wb_thresh; - long numerator, denominator; + unsigned long numerator, denominator; unsigned long wb_min_ratio, wb_max_ratio; =20 /* @@ -777,7 +777,7 @@ static unsigned long __wb_calc_thresh(struct dirty_th= rottle_control *dtc) =20 wb_thresh =3D (thresh * (100 - bdi_min_ratio)) / 100; wb_thresh *=3D numerator; - do_div(wb_thresh, denominator); + wb_thresh =3D div64_ul(wb_thresh, denominator); =20 wb_min_max_ratio(dtc->wb, &wb_min_ratio, &wb_max_ratio); =20 --=20 1.8.3.1