freezer: take kernel_execve into consideration
authorRafael J. Wysocki <rjw@sisk.pl>
Wed, 23 May 2007 20:57:26 +0000 (13:57 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 24 May 2007 03:14:11 +0000 (20:14 -0700)
Kernel threads can become userland processes by calling kernel_execve().

In particular, this may happen right after the try_to_freeze_tasks()
called with FREEZER_USER_SPACE has returned, so try_to_freeze_tasks()
needs to take userspace processes into consideration even if it is
called with FREEZER_KERNEL_THREADS.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/power/process.c

index eefca8581fa0d5f0480a32106c8d94e09f78bca4..2cea2658e9852bf922b65638fb32f20cc33aa5a8 100644 (file)
@@ -120,7 +120,7 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
                                cancel_freezing(p);
                                continue;
                        }
-                       if (is_user_space(p) == !freeze_user_space)
+                       if (freeze_user_space && !is_user_space(p))
                                continue;
 
                        freeze_process(p);
@@ -147,7 +147,7 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
                                TIMEOUT / HZ, todo);
                read_lock(&tasklist_lock);
                do_each_thread(g, p) {
-                       if (is_user_space(p) == !freeze_user_space)
+                       if (freeze_user_space && !is_user_space(p))
                                continue;
 
                        task_lock(p);