mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nish Aravamudan <nish.aravamudan@gmail.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: "Con Kolivas" <kernel@kolivas.org>,
	"Daniel Marjamäki" <daniel.marjamaki@comhem.se>,
	linux-kernel@vger.kernel.org
Subject: Re: I made a patch and would like feedback/testers (drivers/cdrom/aztcd.c)
Date: Mon, 21 Nov 2005 07:08:01 -0800	[thread overview]
Message-ID: <29495f1d0511210708t380b7ff7ic6759d59927c12d1@mail.gmail.com> (raw)
In-Reply-To: <4381A5D7.3020307@yahoo.com.au>

On 11/21/05, Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> Con Kolivas wrote:
> > On Mon, 21 Nov 2005 19:42, Daniel Marjamäki wrote:
>
> >>Hmm.. The minimum value should be 2, right?
> >>Otherwise the loop could time out after only a few nanoseconds.. since the
> >>loop will then timeout immediately on a clock tick. Or am I wrong?
> >
> >
> >       aztTimeOut =  HZ / 500 ? : 1;
> > Would give you a 2ms timeout on 1000Hz and 500Hz
> > It would give you 5ms on 250Hz and 10ms on 100Hz
> >
> > ie the absolute minimum it would be would be 2ms, but it would always be at
> > least one timer tick which is longer than 2ms at low HZ values.
> >
>
> Not true. From 'now', the next timer interrupt is somewhere
> between epsilon and 1/HZ seconds away.
>
> Luckily, time_after is < rather than <=, so your aztTimeOut would
> actually make Daniel's code wait until a minimum of *two* timer
> ticks have elapsed since reading jiffies. So it would manage to
> scrape by the values of HZ you quoted.
>
> OTOH, if HZ were between 500 and 1000, it would again be too short
> due to truncation.
>
> Better I think would be to use the proper interfaces for converting
> msecs to jiffies:
>
>    aztTimeOut = jiffies + msecs_to_jiffies(2);

That's what I get for sleeping. Yes, Nick is right, don't do this
conversion yourself, please, use the interfaces designed exactly to
avoid any confusion / HZ-issues (and if those interfaces have
limitations, as Willy discovered earlier, please fix them).

Thanks,
Nish

  reply	other threads:[~2005-11-21 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5aZsv-3CJ-17@gated-at.bofh.it>
2005-11-20 20:58 ` Bodo Eggert
2005-11-20 21:07   ` Nish Aravamudan
2005-11-21  8:09   ` Daniel Marjamäki
2005-11-21  8:19     ` Con Kolivas
2005-11-21  8:42       ` Daniel Marjamäki
2005-11-21  9:11         ` Con Kolivas
2005-11-21 10:47           ` Nick Piggin
2005-11-21 15:08             ` Nish Aravamudan [this message]
2005-11-21 16:33       ` Bodo Eggert
2005-11-20 15:29 Daniel Marjamäki
2005-11-20 15:38 ` Arjan van de Ven
2005-11-20 17:15   ` Thomas Gleixner
2005-11-20 21:04   ` Nish Aravamudan

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=29495f1d0511210708t380b7ff7ic6759d59927c12d1@mail.gmail.com \
    --to=nish.aravamudan@gmail.com \
    --cc=daniel.marjamaki@comhem.se \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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®