jiffies wrap question...
The following is a piece of code from the latter half of schedule_timeout, in kernel/sched.c. Is it possible that schedule_timeout could return an incorrect value, if the jiffy value wraps between the first and last lines shown below.
expire = timeout + jiffies;
init_timer(&timer);
timer.expires = expire;
timer.data = (unsigned long) current;
timer.function = process_timeout;
add_timer(&timer);
schedule();
del_timer_sync(&timer);
timeout = expire - jiffies;Signature · 7 lines
Jeff Garzik | Building 1024 | Would you like a Twinkie? MandrakeSoft | - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] Please read the FAQ at http://www.tux.org/lkml/
Quoted 4 lines · Jeff Garzik
The following is a piece of code from the latter half of
schedule_timeout, inkernel/sched.c. Is it possible thatschedule_timeoutcould return an incorrect value, if the jiffy value wraps between the first and last lines shown below.
let's say the first line happens n ticks before the wrap and the second, m ticks afterwards.
Quoted 1 line
expire = timeout + jiffies;
expire = timeout + 2^32/2^64 - n = timeout - n
Quoted 1 line
timeout = expire - jiffies;
timeout = expire - m = timeout - n - m = timeout - (n+m)
(n+m) is the time that actually passed while we were asleep, and timeout has the correct value (timeout - ticks that happened)>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/