public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Is there a problem in timeval_to_jiffies?
@ 2004-09-09 13:48 Henry Margies
  2004-09-12 14:33 ` Henry Margies
  0 siblings, 1 reply; 12+ messages in thread
From: Henry Margies @ 2004-09-09 13:48 UTC (permalink / raw)
  To: linux-kernel

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!


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <2CxDn-2ib-51@gated-at.bofh.it>]

end of thread, other threads:[~2004-10-01 11:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09 13:48 Is there a problem in timeval_to_jiffies? Henry Margies
2004-09-12 14:33 ` Henry Margies
2004-09-16  3:30   ` Randy.Dunlap
2004-09-16  9:54     ` George Anzinger
2004-09-16 15:38       ` Henry Margies
2004-09-16 18:10       ` Henry Margies
     [not found]       ` <20040916200203.6259e113.henry.margies@gmx.de>
2004-09-16 20:19         ` George Anzinger
2004-09-17  9:55           ` Henry Margies
2004-09-29 20:56             ` Tim Bird
2004-09-29 21:24               ` Jon Masters
2004-10-01 11:42               ` Henry Margies
     [not found] <2CxDn-2ib-51@gated-at.bofh.it>
     [not found] ` <2DDGs-7Om-31@gated-at.bofh.it>
     [not found]   ` <2EVhQ-6Qe-5@gated-at.bofh.it>
     [not found]     ` <2F1e7-2r9-21@gated-at.bofh.it>
     [not found]       ` <2Fb3o-1cT-27@gated-at.bofh.it>
     [not found]         ` <2Fb3o-1cT-25@gated-at.bofh.it>
     [not found]           ` <2FnQM-1wt-1@gated-at.bofh.it>
     [not found]             ` <2JTS7-5Ri-3@gated-at.bofh.it>
2004-09-29 22:03               ` Andi Kleen

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