Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18726071ybl; Fri, 3 Jan 2020 07:56:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzx9i0OTEwUgiapUxX49AtENu7ZXs4quXLP2ZKgPKr1IHRIYNf8R2Q0ObAVo6Y+Xi35Me9b X-Received: by 2002:a9d:7e99:: with SMTP id m25mr95121969otp.212.1578066998821; Fri, 03 Jan 2020 07:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578066998; cv=none; d=google.com; s=arc-20160816; b=YY4eid2mltu6x2iAcoNhfExF0WWrVlyg6eZQEVGP3Ch4dPgQgRe5NFq+/lG7j4QQVC aQCnnpmQc05uUw5t7y0vXi4yzGlcTTt57Ch2kFehKSpi/Q2PM5NAMHpJXrlfk1iOXocy OtZdKSc2im4rGIYki1i9FWsWhsXGLr12m3hMgQSS1RI2CSJ9/04fyVJ1+clz3xYdjldn ReAppH5jRHsZawj1ZanRlAi0wh2BQDjFMhdTRsI/Jfx5CrXsg35SKqC1HoOY0XG+Ui5G j2OFFjJhe1Yp/fc2QjeqotMMlmjim/0jPrZB+nOD/PI5urptXhvwJJKArJhzFb/gzPoT nJeQ== 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 :message-id:date:subject:cc:to:from; bh=EDl9hC6iZHx9D5ugUkf76aWkiR1ELoWxK3fTqGJjKP0=; b=I/Bps/pibjITBbHbNq9Xrec/Jsv9u3lfCD436rgv56YYuiEzfuvoo4geXHq/YK7tJf lOMumAcHnSZ5L+TOwbxhSJjxtsQmGMgK629n0IKcMRmHD13lbmsy3B+IqobKOAv/KoD/ 1CyFJstjSAr0rB7/jYyPRTnEtDIUU/i7nDhlPC573hlshh5O/yjP6GdE3QHX/NY5jQ9p yG1YHxeuVfkzCWnY69j2JKRC720f4718AgckubqfZ6NIuyRJOqyzb2R2/hPpIYQvO1R1 rq8evIrAI5wuixC38RQnkeUHAoHnMagfanvgcxkG3+BYm/ePotXYixWQrxUzkh6+EW9S 87Kg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si30908406oti.249.2020.01.03.07.56.26; Fri, 03 Jan 2020 07:56:38 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727938AbgACPzj (ORCPT + 99 others); Fri, 3 Jan 2020 10:55:39 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:55347 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727539AbgACPzi (ORCPT ); Fri, 3 Jan 2020 10:55:38 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TmkQCWM_1578066930; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TmkQCWM_1578066930) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Jan 2020 23:55:35 +0800 From: Wen Yang To: John Stultz , Thomas Gleixner , Stephen Boyd Cc: Wen Yang , linux-kernel@vger.kernel.org Subject: [PATCH] timekeeping: improve arithmetic divisions Date: Fri, 3 Jan 2020 23:55:17 +0800 Message-Id: <20200103155517.21754-1-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_div() does a 64-by-32 division. Use div64_u64() instead of do_div() if the divisor is u64, to avoid truncation to 32-bit. Signed-off-by: Wen Yang Cc: John Stultz Cc: Thomas Gleixner Cc: Stephen Boyd Cc: linux-kernel@vger.kernel.org --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ca69290..bad76c1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1007,7 +1007,7 @@ static int scale64_check_overflow(u64 mult, u64 div, u64 *base) tmp *= mult; rem *= mult; - do_div(rem, div); + rem = div64_u64(rem, div); *base = tmp + rem; return 0; } -- 1.8.3.1