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

From: Petr Tesarik

Date: Wed Nov 18 2026 - 07:07:59 EST


Ping!

If you're not interested in clarifying magic constants in code, please
also let me know, so I won't waste my time on such tasks next time.

Petr T

On Tue, 27 Oct 2026 13:37:46 +0100
Petr Tesarik <ptesarik@xxxxxxxx> wrote:

> Hi all,
>
> what about this series? It's not super-important, but neither should it
> be too hard to review...
>
> Petr T
>
> On Wed, 14 Oct 2026 15:29:29 +0200
> Petr Tesarik <ptesarik@xxxxxxxx> wrote:
>
> > 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(-)
> >
>