diff options
author | Tejun Heo <tj@kernel.org> | 2011-11-21 15:32:24 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-11-21 15:32:24 -0500 |
commit | 0c9af09262864a2744091ee94c98c4a8fd60c98b (patch) | |
tree | e7dacbb7f370e0d7c515ed743a2c5b5179a1de5e /kernel/power/process.c | |
parent | 6cd8dedcdd8e8de01391a7cf25f0b2afeb24f8f4 (diff) |
freezer: use dedicated lock instead of task_lock() + memory barrier
Freezer synchronization is needlessly complicated - it's by no means a
hot path and the priority is staying unintrusive and safe. This patch
makes it simply use a dedicated lock instead of piggy-backing on
task_lock() and playing with memory barriers.
On the failure path of try_to_freeze_tasks(), locking is moved from it
to cancel_freezing(). This makes the frozen() test racy but the race
here is a non-issue as the warning is printed for tasks which failed
to enter frozen for 20 seconds and race on PF_FROZEN at the last
moment doesn't change anything.
This simplifies freezer implementation and eases further changes
including some race fixes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r-- | kernel/power/process.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 9db048fb0d70..bd420ca48261 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -118,11 +118,9 @@ static int try_to_freeze_tasks(bool sig_only) | |||
118 | 118 | ||
119 | read_lock(&tasklist_lock); | 119 | read_lock(&tasklist_lock); |
120 | do_each_thread(g, p) { | 120 | do_each_thread(g, p) { |
121 | task_lock(p); | ||
122 | if (!wakeup && freezing(p) && !freezer_should_skip(p)) | 121 | if (!wakeup && freezing(p) && !freezer_should_skip(p)) |
123 | sched_show_task(p); | 122 | sched_show_task(p); |
124 | cancel_freezing(p); | 123 | cancel_freezing(p); |
125 | task_unlock(p); | ||
126 | } while_each_thread(g, p); | 124 | } while_each_thread(g, p); |
127 | read_unlock(&tasklist_lock); | 125 | read_unlock(&tasklist_lock); |
128 | } else { | 126 | } else { |