netdev
[Top] [All Lists]

Re: MSEC_TO_JIFFIES is messed up...

To: Andrew Morton <akpm@xxxxxxxx>
Subject: Re: MSEC_TO_JIFFIES is messed up...
From: Jeff Garzik <jgarzik@xxxxxxxxx>
Date: Wed, 12 May 2004 16:44:41 -0400
Cc: mingo@xxxxxxx, davidel@xxxxxxxxxxxxxxx, greg@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040512133520.44fbfd39.akpm@xxxxxxxx>
References: <20040512020700.6f6aa61f.akpm@xxxxxxxx> <20040512181903.GG13421@xxxxxxxxx> <40A26FFA.4030701@xxxxxxxxx> <20040512193349.GA14936@xxxxxxx> <Pine.LNX.4.58.0405121247011.11950@xxxxxxxxxxxxxxxxxxxxxxx> <20040512200305.GA16078@xxxxxxx> <20040512132050.6eae6905.akpm@xxxxxxxx> <40A28815.2020009@xxxxxxxxx> <20040512133520.44fbfd39.akpm@xxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703
Andrew Morton wrote:
Jeff Garzik <jgarzik@xxxxxxxxx> wrote:

How about we do:

> > #if HZ=1000
> #define    MSEC_TO_JIFFIES(msec) (msec)
> #define JIFFIES_TO_MESC(jiffies) (jiffies)
> #elif HZ=100
> #define    MSEC_TO_JIFFIES(msec) (msec * 10)
> #define JIFFIES_TO_MESC(jiffies) (jiffies / 10)
> #else
> #define    MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000)
> #define    JIFFIES_TO_MSEC(jiffies) ...
> #endif
> > in some kernel-wide header then kill off all the private implementations?


include/linux/time.h. One of the SCTP people already did this, but I suppose it's straightforward to reproduce.


OK, I'll do it.


Thanks. 'grep -i msec.*jif' and 'grep -i jif.*msec' should catch most, there are occurences in both upper and lower case.

Note that a few oddball drivers include an addition to the kernel-wide 'jiffies' variable, rather than just doing a calculation scaling against HZ.

        Jeff




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