From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: jdavis@accessline.com, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bad rounding in timeval_to_jiffies [was: Re: Odd Timer behavior in 2.6 vs 2.4 (1 extra tick)]
Date: Thu, 21 Apr 2005 09:51:09 +0100 [thread overview]
Message-ID: <20050421095109.A25431@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1114054816.5996.10.camel@localhost.localdomain>; from rostedt@goodmis.org on Wed, Apr 20, 2005 at 11:40:16PM -0400
On Wed, Apr 20, 2005 at 11:40:16PM -0400, Steven Rostedt wrote:
> Is 11 jiffies correct for 10ms?
Consider the 1 jiffy case. How long does waiting one jiffy actually wait?
j=0 1 2
+--------------+--------------+--> t
A B C D
If you start timing one jiffy from A, you're looking for j=1, so your
timer expires close to D and you have waited one jiffy.
If you start timing one jiffy from B, you're still looking for j=1.
Your timer expires at the same point (D) but you've waited less than
one jiffy.
If you start timing one jiffy from C, it's the same - expires at D.
This time, you've waited virtually no time at all.
The problem is that when you add a timer, you don't have any idea
which point you're going to be starting your timer at.
This is why we always round up to the next jiffy when we convert
times to jiffies - this ensures that you will get at _least_ the
timeout you requested, which is in itself a very important
guarantee.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2005-04-21 8:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-08 17:39 Odd Timer behavior in 2.6 vs 2.4 (1 extra tick) jdavis
2005-04-08 22:19 ` Steven Rostedt
2005-04-21 2:58 ` [PATCH] Bad rounding in timeval_to_jiffies [was: Re: Odd Timer behavior in 2.6 vs 2.4 (1 extra tick)] Steven Rostedt
2005-04-21 3:40 ` Steven Rostedt
2005-04-21 8:51 ` Russell King [this message]
2005-04-21 10:51 ` Steven Rostedt
2005-04-21 14:58 ` Linus Torvalds
2005-04-21 15:34 ` Steven Rostedt
2005-04-21 15:53 ` Chris Friesen
2005-04-21 16:13 ` Linus Torvalds
2005-04-22 2:54 ` Edgar Toernig
2005-04-29 21:28 ` Odd Timer behavior in 2.6 vs 2.4 (1 extra tick) 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=20050421095109.A25431@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=akpm@osdl.org \
--cc=jdavis@accessline.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@osdl.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