netdev
[Top] [All Lists]

Re: MSEC_TO_JIFFIES is messed up...

To: Davide Libenzi <davidel@xxxxxxxxxxxxxxx>
Subject: Re: MSEC_TO_JIFFIES is messed up...
From: Peter Williams <peterw@xxxxxxxxxx>
Date: Thu, 13 May 2004 09:33:48 +1000
Cc: Valdis.Kletnieks@xxxxxx, Andrew Morton <akpm@xxxxxxxx>, Netdev <netdev@xxxxxxxxxxx>, Greg KH <greg@xxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
In-reply-to: <Pine.LNX.4.58.0405121255170.11950@xxxxxxxxxxxxxxxxxxxxxxx>
Organization: Aurema Pty Ltd
References: <20040512020700.6f6aa61f.akpm@xxxxxxxx> <20040512181903.GG13421@xxxxxxxxx> <40A26FFA.4030701@xxxxxxxxx> <20040512193349.GA14936@xxxxxxx> <200405121947.i4CJlJm5029666@xxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.58.0405121255170.11950@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1
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
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...


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.

Peter
--
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 http://www.aurema.com


<Prev in Thread] Current Thread [Next in Thread>