mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PATCH: add framework for ndelay (nanoseconds)
Date: Thu, 6 Feb 2003 17:49:44 +0300	[thread overview]
Message-ID: <20030206174944.A17905@jurassic.park.msu.ru> (raw)
In-Reply-To: <Pine.GSO.4.21.0302051533320.16681-100000@vervain.sonytel.be>; from geert@linux-m68k.org on Wed, Feb 05, 2003 at 03:34:31PM +0100

On Wed, Feb 05, 2003 at 03:34:31PM +0100, Geert Uytterhoeven wrote:
> On Sun, 2 Feb 2003, Linux Kernel Mailing List wrote:
> > ChangeSet 1.953.4.9, 2003/02/02 02:44:15-02:00, alan@lxorguk.ukuu.org.uk
> > 
> > 	[PATCH] PATCH: add framework for ndelay (nanoseconds)
> > 	
> > +void __ndelay(unsigned long usecs)
>                                ^^^^^
> > +{
> > +	__const_udelay(usecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
>                        ^^^^^
> > +}
> 
> Wouldn't it make more sense to call the parameter `nsecs' (or `ns')?

There are more serious problems with this implementation:
1) It's *very* imprecise. Even on an 1 GHz CPU and with HZ = 100 precision
   is ~86 nsec. With HZ = 1000 it's almost unusable on *any* CPU.
2) Additional delay caused by integer multiplication, cache misses
   and so on may be large enough, especially on older processors.
   On 233 MHz PII it's 600-700 nsec (perfectly repeatable), on 600 MHz
   alpha ev56 - 200-300 nsec.

As of current 2.4, there is the only user of ndelay() - ide_execute_command()
that calls ndelay(400). Why udelay(1) cannot be used instead?

Ivan.

  reply	other threads:[~2003-02-06 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200302040533.h145Xqq19457@hera.kernel.org>
2003-02-05 14:34 ` Geert Uytterhoeven
2003-02-06 14:49   ` Ivan Kokshaysky [this message]
2003-02-06 15:53     ` Alan Cox
2003-02-06 15:05       ` Ivan Kokshaysky
2003-02-06 17:41       ` Ross Biro

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=20030206174944.A17905@jurassic.park.msu.ru \
    --to=ink@jurassic.park.msu.ru \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®