[PATCH 0/2] freezer,sched: do not restore saved_state of a thawed task

From: Elliot Berman
Date: Mon Nov 20 2023 - 12:37:16 EST


This series applies couple fixes to commit 8f0eed4a78a8 ("freezer,sched:
Use saved_state to reduce some spurious wakeups") which was found while
testing with legacy cgroup freezer. My original testing was only with
system-wide freezer. We found that thaw_task could be called on a task
which was already frozen. Prior to commit 8f0eed4a78a8 ("freezer,sched:
Use saved_state to reduce some spurious wakeups"), this wasn't an issue
as kernel would try to wake up TASK_FROZEN, which wouldn't match the
thawed task state, and no harm done to task. After commit 8f0eed4a78a8
("freezer,sched: Use saved_state to reduce some spurious wakeups"), it
was possible to overwrite the state of thawed task.

To: Rafael J. Wysocki <rafael@xxxxxxxxxx>
To: Pavel Machek <pavel@xxxxxx>
To: Ingo Molnar <mingo@xxxxxxxxxx>
To: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: <linux-arm-msm@xxxxxxxxxxxxxxx>
Cc: Pavan Kondeti <quic_pkondeti@xxxxxxxxxxx>
Cc: Aiqun Yu (Maria) <quic_aiquny@xxxxxxxxxxx>
Cc: <linux-pm@xxxxxxxxxxxxxxx>
Cc: <linux-kernel@xxxxxxxxxxxxxxx>
Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>

Originally sent to only linux-arm-msm, resending to correct authors.
- Link to v1: https://lore.kernel.org/r/20231120-freezer-state-multiple-thaws-v1-0-a4c453f50745@xxxxxxxxxxx

---
Elliot Berman (2):
freezer,sched: do not restore saved_state of a thawed task
freezer,sched: clean saved_state when restoring it during thaw

kernel/freezer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
base-commit: 6d7e4782bcf549221b4ccfffec2cf4d1a473f1a3
change-id: 20231108-freezer-state-multiple-thaws-7a3a8d9dadb3

Best regards,
--
Elliot Berman <quic_eberman@xxxxxxxxxxx>