Re: [timer] max timeout

george anzinger (george@mvista.com)
Fri, 25 May 2001 13:58:46 -0700


sebastien person wrote:
>
> Hi,
>
> is there a max timeout to respect when I use mod_timer ? or add_timer ?
>
> Is it bad to do the following call ?
>
> mod_timer(&timer, jiffies+(0.1*HZ));
>
> that might fire the timer 1/10 second later.
>
> Thanks.
>
More than enough on the fp. Now the other question.

The time value is in jiffies (aka 1/Hz sec.). The max value (in a 32
bit system) is 0x7ffffff. This value is added to the current value of
jiffies to get the the absolute timer expire time. While the value is
unsigned (and thus you could go higher) the compare code (timer_before()
and timer_after()) depend on the subtraction (of jiffies from expire) to
be of the correct sign. To insure this you must keep the timeout values
sign clear (or if you don't like to think of an unsigned as having a
sign, then the highest order bit must be zero).

George
-
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/