From: Tim Bird <tim.bird@am.sony.com>
To: Henry Margies <henry.margies@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Is there a problem in timeval_to_jiffies?
Date: Wed, 29 Sep 2004 13:56:24 -0700 [thread overview]
Message-ID: <415B2178.7060907@am.sony.com> (raw)
In-Reply-To: <20040917115502.33831479.henry.margies@gmx.de>
Henry Margies wrote:
> Right? But for arm, with a jiffie size of 10000000, it is much
> more easier. And that is why I don't understand why an one second
> interval is converted to 101 jiffies (on arm).
...
> I agree. But then, why adding one jiffie to every interval? If
> there is no latency, the timer should appear right at the
> beginning of a jiffie. For x86 you are right, because 10 jiffies
> are less then 10ms. But for arm, 1 jiffie is precisely 10ms.
How does the computer "know" that the timer is at the beginning
of the jiffy? By definition, Linux (without HRT support) has
no way of dealing with sub-jiffy resolution for timers.
Maybe a graphic (ascii-graphic) will help:
tick 1 ---------------------
tick 2 ---------------------
schedule point A ->
schedule point B ->
tick 3 ---------------------
tick 4 ---------------------
tick 5 ---------------------
Let's say, that at point A, you ask for a 20 millisecond timer.
(2 jiffies, on ARM). You think you are asking for a timer to fire
on tick 4 (20 milliseconds after tick 2), but Linux can't
distinguish point A from point B. In order to avoid
the situation where someone scheduled a 20 millisecond timer
at point B, and had it fire on tick 4 (only 10 milliseconds
later), Linux adds one jiffy to the expiration time.
Both timers (set at point A or point B) would fire
on tick 5. For the A timer, this makes it 30 milliseconds
(or, jiffies plus one) later, which looks pretty bad.
For the B timer, the interval would be close to 20
milliseconds, which looks pretty good.
If you are rescheduling one-shot timers immediately
after they fire, you should 'undershoot' on the time
interval, to hit the tick boundary you want, based
on the jiffy resolution of your platform.
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================
next prev parent reply other threads:[~2004-09-29 20:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-09 13:48 Is there a problem in timeval_to_jiffies? Henry Margies
2004-09-12 14:33 ` Henry Margies
2004-09-16 3:30 ` Randy.Dunlap
2004-09-16 9:54 ` George Anzinger
2004-09-16 15:38 ` Henry Margies
2004-09-16 18:10 ` Henry Margies
[not found] ` <20040916200203.6259e113.henry.margies@gmx.de>
2004-09-16 20:19 ` George Anzinger
2004-09-17 9:55 ` Henry Margies
2004-09-29 20:56 ` Tim Bird [this message]
2004-09-29 21:24 ` Jon Masters
2004-10-01 11:42 ` Henry Margies
[not found] <2CxDn-2ib-51@gated-at.bofh.it>
[not found] ` <2DDGs-7Om-31@gated-at.bofh.it>
[not found] ` <2EVhQ-6Qe-5@gated-at.bofh.it>
[not found] ` <2F1e7-2r9-21@gated-at.bofh.it>
[not found] ` <2Fb3o-1cT-27@gated-at.bofh.it>
[not found] ` <2Fb3o-1cT-25@gated-at.bofh.it>
[not found] ` <2FnQM-1wt-1@gated-at.bofh.it>
[not found] ` <2JTS7-5Ri-3@gated-at.bofh.it>
2004-09-29 22:03 ` Andi Kleen
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=415B2178.7060907@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=henry.margies@gmx.de \
--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