linux/kernel/power
Oleg Nesterov 5d8f72b55c freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
to ensure that a task doing STOPPED/TRACED -> RUNNING transition
can't escape freezing. This mostly works, but ptrace_stop() does
not necessarily call schedule(), it can change task->state back to
RUNNING and check freezing() without any lock/barrier in between.

We could add the necessary barrier, but this patch changes
ptrace_stop() and do_signal_stop() to use freezable_schedule().
This fixes the race, freezer_count() and freezer_should_skip()
carefully avoid the race.

And this simplifies the code, try_to_freeze_tasks/update_if_frozen
no longer need to use task_is_stopped_or_traced() checks with the
non trivial assumptions. We can rely on the mechanism which was
specially designed to mark the sleeping task as "frozen enough".

v2: As Tejun pointed out, we can also change get_signal_to_deliver()
and move try_to_freeze() up before 'relock' label.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2012-10-26 14:27:49 -07:00
..
autosleep.c PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources 2012-05-01 21:25:49 +02:00
block_io.c block: kill off REQ_UNPLUG 2011-03-10 08:52:27 +01:00
console.c PM / VT: Cleanup #if defined uglyness and fix compile error 2011-10-16 23:28:51 +02:00
hibernate.c Power management updates for 3.6 2012-07-22 13:36:52 -07:00
Kconfig PM / Domains: Add power off/on function for system core suspend stage 2012-09-04 01:36:01 +02:00
main.c PM / Sleep: Separate printing suspend times from initcall_debug 2012-07-01 13:31:23 +02:00
Makefile PM / Sleep: Add user space interface for manipulating wakeup sources, v3 2012-05-01 21:26:05 +02:00
power.h PM / Hibernate: Enable suspend to both for in-kernel hibernation. 2012-07-01 13:31:22 +02:00
poweroff.c properly __init-annotate pm_sysrq_init() 2012-09-10 21:21:58 +02:00
process.c freezer: change ptrace_stop/do_signal_stop to use freezable_schedule() 2012-10-26 14:27:49 -07:00
qos.c PM / QoS: Add return code to pm_qos_get_value function. 2012-09-07 21:35:21 +02:00
snapshot.c Power management updates for 3.4 2012-03-21 10:15:51 -07: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 Revert "NMI watchdog: fix for lockup detector breakage on resume" 2012-08-08 20:49:45 +02:00
swap.c PM / Hibernate: Print hibernation/thaw progress indicator one line at a time. 2012-07-01 13:31:23 +02:00
user.c Make wait_for_device_probe() also do scsi_complete_async_scans() 2012-07-18 18:15:46 -07:00
wakelock.c PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock 2012-07-19 00:00:58 +02:00