Is there a problem in timeval_to_jiffies?

From: Henry Margies (henry.margies_at_gmx.de)
Date: 09/09/04

  • Next message: rom.132: "floppy problem 2.6.9"
    Date:	Thu, 9 Sep 2004 15:48:28 +0200
    To: linux-kernel@vger.kernel.org
    
    

    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@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: rom.132: "floppy problem 2.6.9"

    Relevant Pages

    • Re: sched.c function
      ... I had a wild idea to process one function that ... or should i implement timer? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: RT and Cascade interrupts
      ... > My point is that you are considering timer bugs due to synchronization ... >>application task in the midst of an RPC. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] mm - implement swap prefetching
      ... practice was that the amount of dirty ram was an extraordinarily good marker ... The timer just made it easy to start and stop it completely before I ... turned prefetch into a daemon and it kinda stayed that way. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: RT and Cascade interrupts
      ... the scope of the RPC code was to replace the bit state of ... fact the timer was requeued during the preemption window. ... The former has simpler locking requirements but requires ... 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/ ...
      (Linux-Kernel)
    • nt authority system
      ... any time saying that the system needs to close and a ... timer starts counting down from 60 seconds then the ...
      (microsoft.public.windowsxp.help_and_support)

    Loading