diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-12-13 03:34:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:49 -0500 |
commit | 3df494a32b936aef76d893f5065f962ebd9b9437 (patch) | |
tree | 825a96b219eeb87ef7a627a2494cf4fa7cd4d03e /kernel/signal.c | |
parent | 6a2d7a955d8de6cb19ed9cd194b3c83008a22c32 (diff) |
[PATCH] PM: Fix freezing of stopped tasks
Currently, if a task is stopped (ie. it's in the TASK_STOPPED state), it
is considered by the freezer as unfreezeable. However, there may be a race
between the freezer and the delivery of the continuation signal to the task
resulting in the task running after we have finished freezing the other
tasks. This, in turn, may lead to undesirable effects up to and including
data corruption.
To prevent this from happening we first need to make the freezer consider
stopped tasks as freezeable. For this purpose we need to make freezeable()
stop returning 0 for these tasks and we need to force them to enter the
refrigerator. However, if there's no continuation signal in the meantime,
the stopped tasks should remain stopped after all processes have been
thawed, so we need to send an additional SIGSTOP to each of them before
waking it up.
Also, a stopped task that has just been woken up should first check if
there's a freezing request for it and go to the refrigerator if that's the
case.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 1921ffdc5e7..5630255d2e2 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1705,7 +1705,9 @@ finish_stop(int stop_count) | |||
1705 | read_unlock(&tasklist_lock); | 1705 | read_unlock(&tasklist_lock); |
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | schedule(); | 1708 | do { |
1709 | schedule(); | ||
1710 | } while (try_to_freeze()); | ||
1709 | /* | 1711 | /* |
1710 | * Now we don't run again until continued. | 1712 | * Now we don't run again until continued. |
1711 | */ | 1713 | */ |