Is there a problem in timeval_to_jiffies?

From: Henry Margies
Date: Thu Sep 09 2004 - 08:56:06 EST


Hallo.


I'm working on an arm based embedded device running kernel 2.6.9.
I asked this question also on the arm mailing list, but nobody
could answer me my questions there, so I will try here :)

I have some problems with itimers. For example, if I set up a
timer using a period of 20ms, the system needs 30ms to send the
signal. I figured out, that it needs always 10ms more than I
want.

The problem seems to be located in the timeval_to_jiffies()
function.

In function do_setitimer() the following calculation is done:

i = timeval_to_jiffies(&value->it_interval);

... where i is the interval for my timer. The problem is, that
for it_interval = 0 seconds and 20000 microseconds, i = 3. But
shouldn't it be 2? It looks like, the problem is somewhere in
here (timeval_to_jiffies()):

return (((u64)sec * SEC_CONVERSION) +
(((u64)usec * USEC_CONVERSION + USEC_ROUND) >>
(USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >>
SEC_JIFFIE_SC;

I don't understand all of the formula in detail. But for me, it
looks like the problem is in USEC_ROUND.

Any ideas?

Thx in advance,
Henry

--

Hi! I'm a .signature virus! Copy me into your
~/.signature to help me spread!

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/