lkml.org 
[lkml]   [2004]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectJiffy based timers/timeouts can expire too soon.
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/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.043 / U:1.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site