[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165149469366.4207.10574054034236381529.tip-bot2@tip-bot2>
Date: Mon, 02 May 2022 12:31:33 -0000
From: "tip-bot2 for Maciej W. Rozycki" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Maciej W. Rozycki" <macro@...am.me.uk>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] time/sched_clock: Use Hz as the unit for clock
rate reporting below 4kHz
The following commit has been merged into the timers/core branch of tip:
Commit-ID: cc1b923a4e378c943386e7fe6205918d43e5fede
Gitweb: https://git.kernel.org/tip/cc1b923a4e378c943386e7fe6205918d43e5fede
Author: Maciej W. Rozycki <macro@...am.me.uk>
AuthorDate: Sun, 24 Apr 2022 12:47:26 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 02 May 2022 14:29:04 +02:00
time/sched_clock: Use Hz as the unit for clock rate reporting below 4kHz
The kernel uses kHz as the unit for clock rates reported between 1MHz
(inclusive) and 4MHz (exclusive), e.g.:
sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
This reduces the amount of data lost due to rounding, but hasn't been
replicated for the kHz range when support was added for proper reporting of
sub-kHz clock rates. Take the same approach for rates between 1kHz
(inclusive) and 4kHz (exclusive), which makes it consistent.
Signed-off-by: Maciej W. Rozycki <macro@...am.me.uk>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204240106380.9383@angie.orcam.me.uk
---
kernel/time/sched_clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index ee07f3a..4a95c0b 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -203,7 +203,7 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
r = DIV_ROUND_CLOSEST(r, 1000000);
r_unit = 'M';
} else {
- if (r >= 1000) {
+ if (r >= 4000) {
r = DIV_ROUND_CLOSEST(r, 1000);
r_unit = 'k';
} else {
Powered by blists - more mailing lists