linux_dsm_epyc7002/kernel/power
Matt Helsley 5a7aadfe2f 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>
2010-03-26 23:51:44 +01:00
..
console.c vt: introduce and use vt_kmsg_redirect() function 2009-12-15 08:53:28 -08:00
hibernate_nvs.c PM/Hibernate: Move NVS routines into a seperate file (v2). 2009-06-12 21:32:33 +02:00
hibernate.c mm/pm: force GFP_NOIO during suspend/hibernation and resume 2010-03-06 11:26:26 -08:00
Kconfig PM: Add facility for advanced testing of async suspend/resume 2010-02-26 20:39:10 +01:00
main.c PM: Add a switch for disabling/enabling asynchronous suspend/resume 2010-02-26 20:39:10 +01:00
Makefile PM / Hibernate: Shift remaining code from swsusp.c to hibernate.c 2009-12-06 16:16:07 +01:00
power.h PM/Hibernate: Do not release preallocated memory unnecessarily (rev. 2) 2009-09-14 20:26:58 +02:00
poweroff.c trivial: kernel/power/poweroff.c: whitespace fix 2009-06-12 18:01:46 +02:00
process.c Freezer: Fix buggy resume test for tasks frozen with cgroup freezer 2010-03-26 23:51:44 +01:00
snapshot.c PM / Hibernate: Fix preallocating of memory 2010-02-26 20:39:13 +01:00
suspend_test.c PM: Make warning in suspend_test_finish() less likely to happen 2009-10-22 08:23:45 +09:00
suspend.c mm/pm: force GFP_NOIO during suspend/hibernation and resume 2010-03-06 11:26:26 -08:00
swap.c PM / Hibernate: Swap, remove useless check from swsusp_read() 2010-02-26 20:39:11 +01:00
user.c PM / Hibernate: Really deprecate deprecated user ioctls 2010-02-26 20:39:11 +01:00