lkml.org 
[lkml]   [2004]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH][RESEND] Fix msleep to sleep _at_least_ the requested amount
    From
    Date
    Hi Linus !

    You "agreed" but didn't apply the patch on the last message ... so here
    it is again.


    Makes sure msleep() sleeps at least the amount provided, since
    schedule_timeout() doesn't guarantee a full jiffy.

    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

    ===== kernel/timer.c 1.100 vs edited =====
    --- 1.100/kernel/timer.c 2004-10-19 19:40:28 +10:00
    +++ edited/kernel/timer.c 2004-10-23 09:16:10 +10:00
    @@ -1605,7 +1605,7 @@
    */
    void msleep(unsigned int msecs)
    {
    - unsigned long timeout = msecs_to_jiffies(msecs);
    + unsigned long timeout = msecs_to_jiffies(msecs) + 1;

    while (timeout) {
    set_current_state(TASK_UNINTERRUPTIBLE);
    @@ -1621,7 +1621,7 @@
    */
    unsigned long msleep_interruptible(unsigned int msecs)
    {
    - unsigned long timeout = msecs_to_jiffies(msecs);
    + unsigned long timeout = msecs_to_jiffies(msecs) + 1;

    while (timeout && !signal_pending(current)) {
    set_current_state(TASK_INTERRUPTIBLE);

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

    \
     
     \ /
      Last update: 2005-03-22 14:07    [W:0.040 / U:1.688 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site