lkml.org 
[lkml]   [2011]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [BUG] TASK_DEAD task is able to be woken up in special condition
    > On 12/26, Yasunori Goto wrote:
    > >
    > > >
    > > > IIRC, this was already discussed a bit. Say, try_to_wake_up(TASK_INTERRUPTIBLE)
    > > > can wakeup a TASK_UNINTERRUPTIBLE task if it temporary sets INTERRUPTIBLE but
    > > > doesn't call schedule() in this state.
    > >
    > > Oleg-san,
    > >
    > > Could you point the discussion?
    > > I don't understand yet how it occurred...
    >
    > Suppose that the task T does
    >
    > set_current_state(TASK_INTERRUPTIBLE);
    >
    > set_current_state(TASK_UNINTERRUPTIBLE);
    > schedule();
    >
    > try_to_wake_up(TASK_UNINTERRUPTIBLE) in between can observe this task
    > in TASK_INTERRUPTIBLE state. Then it can set RUNNING/WAKING after T
    > sets ->state = TASK_UNINTERRUPTIBLE.
    >
    > For example, this is possibly if T simply does wait_event() twice when
    > the the 1st wait_event() doesn't sleep.
    >
    > Basically this is the same race you described, but I think you found
    > the case when we can't tolerate the spurious wakeup.
    >
    > Oleg.
    >
    > On 12/26, Yasunori Goto wrote:
    > >
    > > >
    > > > IIRC, this was already discussed a bit. Say, try_to_wake_up(TASK_INTERRUPTIBLE)
    > > > can wakeup a TASK_UNINTERRUPTIBLE task if it temporary sets INTERRUPTIBLE but
    > > > doesn't call schedule() in this state.
    > >
    > > Oleg-san,
    > >
    > > Could you point the discussion?
    > > I don't understand yet how it occurred...
    >
    > Suppose that the task T does
    >
    > set_current_state(TASK_INTERRUPTIBLE);
    >
    > set_current_state(TASK_UNINTERRUPTIBLE);
    > schedule();
    >
    > try_to_wake_up(TASK_UNINTERRUPTIBLE) in between can observe this task
    > in TASK_INTERRUPTIBLE state. Then it can set RUNNING/WAKING after T
    > sets ->state = TASK_UNINTERRUPTIBLE.
    >
    > For example, this is possibly if T simply does wait_event() twice when
    > the the 1st wait_event() doesn't sleep.
    >
    > Basically this is the same race you described, but I think you found
    > the case when we can't tolerate the spurious wakeup.

    Thanks.

    I suppose your idea which uses cmpxchg(old_state, RUNNING) is best way.
    I'll remake my patch.



    >
    > Oleg.
    >

    --
    Yasunori Goto




    \
     
     \ /
      Last update: 2011-12-27 07:51    [W:0.037 / U:0.812 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site