]> git.baikalelectronics.ru Git - kernel.git/commit
time/sched_clock: Round the frequency reported to nearest rather than down
authorMaciej W. Rozycki <macro@orcam.me.uk>
Sun, 24 Apr 2022 11:47:20 +0000 (12:47 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 2 May 2022 12:29:04 +0000 (14:29 +0200)
commitd2327beb62142f580161505e6af894b7fa268bc2
treef9ffe0b7acd783e727556651645b1d73cf4f9ea9
parentb0e65177bb4441dd8801ee835298c20c7840b6fd
time/sched_clock: Round the frequency reported to nearest rather than down

The frequency reported for clock sources are rounded down, which gives
misleading figures, e.g.:

 I/O ASIC clock frequency 24999480Hz
 sched_clock: 32 bits at 24MHz, resolution 40ns, wraps every 85901132779ns
 MIPS counter frequency 59998512Hz
 sched_clock: 32 bits at 59MHz, resolution 16ns, wraps every 35792281591ns

Rounding to nearest is more adequate:

 I/O ASIC clock frequency 24999664Hz
 sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 85900499947ns
 MIPS counter frequency 59999728Hz
 sched_clock: 32 bits at 60MHz, resolution 16ns, wraps every 35791556599ns

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204240055590.9383@angie.orcam.me.uk
kernel/time/sched_clock.c