| To: | Sridhar Samudrala <sri@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conversions. |
| From: | Edgar Toernig <froese@xxxxxx> |
| Date: | Fri, 26 Mar 2004 21:45:07 +0100 |
| Cc: | davem@xxxxxxxxxx, jgarzik@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <Pine.LNX.4.58.0403261007370.6718@xxxxxxxxxxxxxxxxxxxxx> |
| References: | <Pine.LNX.4.58.0403251142110.3037@xxxxxxxxxxxxxxxxxxxxx> <20040326014403.39388cb8.froese@xxxxxx> <Pine.LNX.4.58.0403261007370.6718@xxxxxxxxxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
Sridhar Samudrala wrote: > > On Fri, 26 Mar 2004, Edgar Toernig wrote: > > > Sridhar Samudrala wrote: > > > > > >[...] > > > -#define MSECS(ms) (((ms)*HZ/1000)+1) > > > -return (((ms)*HZ+999)/1000); > > > +return (msecs / 1000) * HZ + (msecs % 1000) * HZ / 1000; > > > > Did you check that all users of the new version will work correctly > > with your rounding? Explicit round-up of delays is often required, > > especially when talking to hardware... >[...] > I guess you are referring to cases when HZ < 1000(ex: 100) and msecs is > less than 10. In those cases, the new version returns 0, whereas some of the > older versions return 1. Exactly - but not only <10. Any value that is not exactly representable in jiffies. I.e. for a delay of 15ms one has to wait 2 jiffies on a 100HZ system. Your version would give 1 jiffy = 10ms -- too short. Ciao, ET. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH] Silence cs89x0, Denis Vlasenko |
|---|---|
| Next by Date: | Re: fealnx oopses, Denis Vlasenko |
| Previous by Thread: | Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conversions., Sridhar Samudrala |
| Next by Thread: | Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conversions., Jeff Garzik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |