Skip to content

Commit cc1b923

Browse files
maciej-w-rozyckiKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9206744 commit cc1b923

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/sched_clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
203203
r = DIV_ROUND_CLOSEST(r, 1000000);
204204
r_unit = 'M';
205205
} else {
206-
if (r >= 1000) {
206+
if (r >= 4000) {
207207
r = DIV_ROUND_CLOSEST(r, 1000);
208208
r_unit = 'k';
209209
} else {

0 commit comments

Comments
 (0)