diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-08-16 17:40:23 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-08-16 17:40:23 +0200 |
commit | d3ec3a1fd08f705d1b319db4113590944bcde749 (patch) | |
tree | 598a0da59e027b455f11beab24a96ef1e56fbbcb /kernel/power/process.c | |
parent | sched/x86: Optimize switch_mm() for multi-threaded workloads (diff) | |
parent | Linux 3.11-rc5 (diff) | |
download | linux-d3ec3a1fd08f705d1b319db4113590944bcde749.tar.xz linux-d3ec3a1fd08f705d1b319db4113590944bcde749.zip |
Merge tag 'v3.11-rc5' into sched/core
Merge Linux 3.11-rc5, to pick up the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r-- | kernel/power/process.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index fc0df8486449..06ec8869dbf1 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -109,6 +109,8 @@ static int try_to_freeze_tasks(bool user_only) /** * freeze_processes - Signal user space processes to enter the refrigerator. + * The current thread will not be frozen. The same process that calls + * freeze_processes must later call thaw_processes. * * On success, returns 0. On failure, -errno and system is fully thawed. */ @@ -120,6 +122,9 @@ int freeze_processes(void) if (error) return error; + /* Make sure this task doesn't get frozen */ + current->flags |= PF_SUSPEND_TASK; + if (!pm_freezing) atomic_inc(&system_freezing_cnt); @@ -168,6 +173,7 @@ int freeze_kernel_threads(void) void thaw_processes(void) { struct task_struct *g, *p; + struct task_struct *curr = current; if (pm_freezing) atomic_dec(&system_freezing_cnt); @@ -182,10 +188,15 @@ void thaw_processes(void) read_lock(&tasklist_lock); do_each_thread(g, p) { + /* No other threads should have PF_SUSPEND_TASK set */ + WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK)); __thaw_task(p); } while_each_thread(g, p); read_unlock(&tasklist_lock); + WARN_ON(!(curr->flags & PF_SUSPEND_TASK)); + curr->flags &= ~PF_SUSPEND_TASK; + usermodehelper_enable(); schedule(); |