public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Jiffy based timers/timeouts can expire too soon.
@ 2004-12-02 16:05 David Vrabel
  2004-12-02 16:35 ` Chris Friesen
  2004-12-02 18:47 ` john stultz
  0 siblings, 2 replies; 5+ messages in thread
From: David Vrabel @ 2004-12-02 16:05 UTC (permalink / raw)
  To: Linux Kernel

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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-16 20:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-02 16:05 Jiffy based timers/timeouts can expire too soon David Vrabel
2004-12-02 16:35 ` Chris Friesen
2004-12-02 18:47 ` john stultz
2004-12-02 23:28   ` Anton Blanchard
2004-12-16 20:38     ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox