From: David Vrabel <dvrabel@arcom.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Jiffy based timers/timeouts can expire too soon.
Date: Thu, 02 Dec 2004 16:05:36 +0000 [thread overview]
Message-ID: <41AF3D50.4090707@arcom.com> (raw)
Hi,
Jiffy based timers and timeouts can expire too soon because the timer
interrupt accounts for lost ticks and can increment jiffies by more than 1.
Consider the following:
unsigned long timeout = jiffies + 1;
<--- timer interrupt here:
jiffies += 2 (i.e., catching up one missed interrupt)
if (time_after(jiffies, timeout))
/* but 1 tick worth of time hasn't (necessarily) elapsed */
This was originally observed on an ARM platform[1] but the i386 timer
interrupt appears to behave in a similar way.
Is this solution here to:
1. Not use jiffies for timers/timeouts with only a few ticks?
or
2. Have two independant "jiffies": the existing one which is used for
the wallclock only; and one which counts the number of timer interrupts
and will guarantee that timers don't expire prematurely?
or
3. Something else?
David Vrabel
[1]
http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-December/025695.html
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
next reply other threads:[~2004-12-02 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-02 16:05 David Vrabel [this message]
2004-12-02 16:35 ` Jiffy based timers/timeouts can expire too soon Chris Friesen
2004-12-02 18:47 ` john stultz
2004-12-02 23:28 ` Anton Blanchard
2004-12-16 20:38 ` George Anzinger
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=41AF3D50.4090707@arcom.com \
--to=dvrabel@arcom.com \
--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