[lkml]   [2009]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] It may not be assumed that wake_up(), finish_wait() and co. imply a memory barrier
    On 04/24, David Howells wrote:
    > (2) wake_up() interpolates a write memory barrier before clearing the task
    > state - _if_ it wakes anything up - then there's no problem in the waker
    > either.
    > +A write memory barrier is implied by wake_up() and co. if and only if they wake
    > +something up. The barrier occurs before the task state is cleared, and so sits
    > +between the STORE to indicate the event and the STORE to set TASK_RUNNING:

    Very minor nit. Perhaps it makes sense to mention that we also need the
    barrier before _reading_ the task->state as well. Or not, I am not sure ;)
    Just in case...

    event_indicated = 1;

    Suppose that "event_indicated = 1" leaks into try_to_wake_up() after we
    read p->state. In this case we have


    if (!(p->state & state))
    goto out; // do nothing

    // WINDOW

    event_indicated = 1; // leaked

    In that case the whole

    if (event_indicated)

    can happen in the WINDOW above.

    But again, this is the real nitpick, and probably just the "implementation
    details" which should not be documented.


     \ /
      Last update: 2009-04-24 19:37    [W:0.025 / U:7.892 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site