Re: MSEC_TO_JIFFIES is messed up...

From: Peter Williams
Date: Wed May 12 2004 - 18:41:11 EST

Davide Libenzi wrote:
On Wed, 12 May 2004 Valdis.Kletnieks@xxxxxx wrote:

On Wed, 12 May 2004 21:33:49 +0200, Ingo Molnar said:

* Jeff Garzik <jgarzik@xxxxxxxxx> wrote:

Woah, that's new. And wrong. The code in include/asm-i386/param.h that
# define JIFFIES_TO_MSEC(x) (x)
# define MSEC_TO_JIFFIES(x) (x)

Is not correct. Look at kernel/sched.c for verification of this :)

Yes, that is _massively_ broken.

why is it wrong?

If the kernel jiffie is anything other than exactly 1 msec, you're screwed...

I believe they were talking about include/asm-i386/param.h

There's sometimes a need to change HZ on i386 systems. Specifically, some IDE drives are unable to safely use DMA (this is documented in one of the Kconfig files). Without DMA for the IDE drives many systems experience (a lot of) missed interrupts which can lead to (among other things) lost ticks and very erratic and unpredictable behaviour from input devices such as the mouse.

Also, if defined in terms of HZ only one definition of these macros would be required rather than one for each architecture.

Dr Peter Williams, Chief Scientist peterw@xxxxxxxxxx
Aurema Pty Limited Tel:+61 2 9698 2322
PO Box 305, Strawberry Hills NSW 2012, Australia Fax:+61 2 9699 9174
79 Myrtle Street, Chippendale NSW 2008, Australia

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at