netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: Sridhar Samudrala <sri@us.ibm.com>
Cc: davem@redhat.com, jgarzik@pobox.com,
	linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: [PATCH] Consolidate multiple implementations of jiffies-msecs conversions.
Date: Fri, 26 Mar 2004 21:45:07 +0100	[thread overview]
Message-ID: <20040326214507.0af7c06b.froese@gmx.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0403261007370.6718@localhost.localdomain>

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.

      parent reply	other threads:[~2004-03-26 20:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-25 20:17 [PATCH] Consolidate multiple implementations of jiffies-msecs conversions Sridhar Samudrala
2004-03-25 20:32 ` David S. Miller
2004-03-25 20:36   ` Jeff Garzik
2004-03-25 21:05 ` Bill Rugolsky Jr.
2004-03-25 23:49   ` Sridhar Samudrala
2004-03-26  0:44 ` Edgar Toernig
2004-03-26 18:49   ` Sridhar Samudrala
2004-03-26 19:03     ` Jeff Garzik
2004-03-29 19:57       ` Sridhar Samudrala
2004-03-26 20:45     ` Edgar Toernig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040326214507.0af7c06b.froese@gmx.de \
    --to=froese@gmx.de \
    --cc=davem@redhat.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=sri@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).