[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200103155517.21754-1-wenyang@linux.alibaba.com>
Date: Fri, 3 Jan 2020 23:55:17 +0800
From: Wen Yang <wenyang@...ux.alibaba.com>
To: John Stultz <john.stultz@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>
Cc: Wen Yang <wenyang@...ux.alibaba.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] timekeeping: improve arithmetic divisions
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 <wenyang@...ux.alibaba.com>
Cc: John Stultz <john.stultz@...aro.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Stephen Boyd <sboyd@...nel.org>
Cc: linux-kernel@...r.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
Powered by blists - more mailing lists