lkml.org 
[lkml]   [2007]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fix refrigerator() vs thaw_process() race
On 02/19, Pavel Machek wrote:
>
> > refrigerator() can miss a wakeup, "wait event" loop needs a proper memory
> > ordering.
> >
> > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> >
> > --- WQ/kernel/power/process.c~WAKE 2007-02-18 22:56:49.000000000 +0300
> > +++ WQ/kernel/power/process.c 2007-02-19 01:04:26.000000000 +0300
> > @@ -46,8 +46,10 @@ void refrigerator(void)
> > recalc_sigpending(); /* We sent fake signal, clean it up */
> > spin_unlock_irq(&current->sighand->siglock);
> >
> > - current->state = TASK_UNINTERRUPTIBLE;
> > + set_current_state(TASK_UNINTERRUPTIBLE);
>
>
> Looks okay to me... but this one liner would be exactly as effective,
> right?

I think no, with this one liner we have

while (frozen(current)) {
// ------ WINDOW ------------
set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
}

What if thaw_process() happens in the window above?

We need the barrier exactly because LOAD (check condition) should not
come before STORE (set task->state).

Oleg.

-
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: 2007-02-19 13:15    [W:0.062 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site