Skip to content

Commit

Permalink
fix refrigerator() vs thaw_process() race
Browse files Browse the repository at this point in the history
refrigerator() can miss a wakeup, "wait event" loop needs a proper memory
ordering.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed May 7, 2007
1 parent e87be11 commit 433ecb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ void refrigerator(void)
recalc_sigpending(); /* We sent fake signal, clean it up */
spin_unlock_irq(&current->sighand->siglock);

while (frozen(current)) {
current->state = TASK_UNINTERRUPTIBLE;
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (!frozen(current))
break;
schedule();
}
pr_debug("%s left refrigerator\n", current->comm);
Expand Down

0 comments on commit 433ecb4

Please sign in to comment.