Skip to content

x86/tsc: Remove some magic constants

Petr Tesarik lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 2 repliesIn review
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Use TICK_NSEC instead of (NSEC_PER_SEC / HZ)
- Use HZ_PER_KHZ and KHZ_PER_MHZ from <linux/units.h>

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3x86/tsc: Replace magic constants with xxx_PER_SECarch/x86/kernel/tsc.c+4 -40 replies
2/3x86/tsc: Use HZ_PER_KHZ and KHZ_PER_MHZarch/x86/kernel/tsc.c+19 -200 replies
3/3x86/tsc: Use TSC_CALIBRATE_MULT for the TSC multiplierarch/x86/kernel/tsc.c+5 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] x86/tsc: Remove some magic constants

The TSC code is full of various magic constants, making it difficult to understand the calculations. This patch series tries to document their actual meaning.

No functional change intended, but the code is not bit-for-bit identical; some 32-bit multiplications are converted into 64-bit multiplications, because HZ_PER_KHZ is an unsigned long. If anything, this should reduce the risk of arithmetic overflow.

Changes from v1:
- Use TICK_NSEC instead of (NSEC_PER_SEC / HZ)
- Use HZ_PER_KHZ and KHZ_PER_MHZ from <linux/units.h>

Petr Tesarik (3):
x86/tsc: Replace magic constants with xxx_PER_SEC x86/tsc: Use HZ_PER_KHZ and KHZ_PER_MHZ x86/tsc: Use TSC_CALIBRATE_MULT for the TSC multiplier

 arch/x86/kernel/tsc.c | 54 +++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 27 deletions(-)
Signature · 1 line
2.55.0