summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorMatt Helsley <matthltc@us.ibm.com>2010-03-26 23:51:44 +0100
committerRafael J. Wysocki <rjw@sisk.pl>2010-03-26 23:51:44 +0100
commit5a7aadfe2fcb0f69e2acc1fbefe22a096e792fc9 (patch)
treedc1b649fc6aa05ecd25cab23e464894e660830d5 /kernel/power
parent4f598458ea4450f53e8ed929ee4e66b3404a7286 (diff)
downloadlinux-5a7aadfe2fcb0f69e2acc1fbefe22a096e792fc9.tar.gz
linux-5a7aadfe2fcb0f69e2acc1fbefe22a096e792fc9.tar.bz2
linux-5a7aadfe2fcb0f69e2acc1fbefe22a096e792fc9.zip
Freezer: Fix buggy resume test for tasks frozen with cgroup freezer
When the cgroup freezer is used to freeze tasks we do not want to thaw those tasks during resume. Currently we test the cgroup freezer state of the resuming tasks to see if the cgroup is FROZEN. If so then we don't thaw the task. However, the FREEZING state also indicates that the task should remain frozen. This also avoids a problem pointed out by Oren Ladaan: the freezer state transition from FREEZING to FROZEN is updated lazily when userspace reads or writes the freezer.state file in the cgroup filesystem. This means that resume will thaw tasks in cgroups which should be in the FROZEN state if there is no read/write of the freezer.state file to trigger this transition before suspend. NOTE: Another "simple" solution would be to always update the cgroup freezer state during resume. However it's a bad choice for several reasons: Updating the cgroup freezer state is somewhat expensive because it requires walking all the tasks in the cgroup and checking if they are each frozen. Worse, this could easily make resume run in N^2 time where N is the number of tasks in the cgroup. Finally, updating the freezer state from this code path requires trickier locking because of the way locks must be ordered. Instead of updating the freezer state we rely on the fact that lazy updates only manage the transition from FREEZING to FROZEN. We know that a cgroup with the FREEZING state may actually be FROZEN so test for that state too. This makes sense in the resume path even for partially-frozen cgroups -- those that really are FREEZING but not FROZEN. Reported-by: Oren Ladaan <orenl@cs.columbia.edu> Signed-off-by: Matt Helsley <matthltc@us.ibm.com> Cc: stable@kernel.org Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/process.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index a0480cd4daaf..71ae29052ab6 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -144,7 +144,7 @@ static void thaw_tasks(bool nosig_only)
if (nosig_only && should_send_signal(p))
continue;
- if (cgroup_frozen(p))
+ if (cgroup_freezing_or_frozen(p))
continue;
thaw_process(p);