Re: MSEC_TO_JIFFIES is messed up...

From: Valdis . Kletnieks
Date: Wed May 12 2004 - 14:53:06 EST


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
> > >says:
> > > # 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...

[/usr/src/linux-2.6.6-mm1]2 find include -name '*.h' | xargs egrep '#define HZ '
include/asm-ppc64/param.h:#define HZ 100
include/asm-mips/param.h:#define HZ 100
include/asm-mips/mach-dec/param.h:#define HZ (1 << LOG_2_HZ)
include/asm-x86_64/param.h:#define HZ 100
include/asm-ppc/param.h:#define HZ 100
include/asm-m68k/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 1000
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 100
include/asm-m68knommu/param.h:#define HZ 50
include/asm-m68knommu/param.h:#define HZ 100
include/asm-parisc/param.h:#define HZ 100
include/asm-um/param.h:#define HZ 100
include/asm-sparc/param.h:#define HZ 100
include/asm-s390/param.h:#define HZ 100
include/asm-i386/param.h:#define HZ 100
include/asm-h8300/param.h:#define HZ 100
include/asm-sparc64/param.h:#define HZ 100
include/asm-cris/param.h:#define HZ 100
include/asm-sh/param.h:#define HZ 100

Attachment: pgp00000.pgp
Description: PGP signature