Files
Tim Van Patten 2058bfaa6f cgroup_freezer: cgroup_freezing: Check if not frozen
Mainline: cff5f49d433fcd0063c8be7dd08fa5bf190c6c37
From: v6.7-rc5
Severity: Moderate

task: 189525

commit cff5f49d433fcd0063c8be7dd08fa5bf190c6c37 upstream.

__thaw_task() was recently updated to warn if the task being thawed was
part of a freezer cgroup that is still currently freezing:

	void __thaw_task(struct task_struct *p)
	{
	...
		if (WARN_ON_ONCE(freezing(p)))
			goto unlock;

This has exposed a bug in cgroup1 freezing where when CGROUP_FROZEN is
asserted, the CGROUP_FREEZING bits are not also cleared at the same
time. Meaning, when a cgroup is marked FROZEN it continues to be marked
FREEZING as well. This causes the WARNING to trigger, because
cgroup_freezing() thinks the cgroup is still freezing.

There are two ways to fix this:

1. Whenever FROZEN is set, clear FREEZING for the cgroup and all
children cgroups.
2. Update cgroup_freezing() to also verify that FROZEN is not set.

This patch implements option (2), since it's smaller and more
straightforward.

Signed-off-by: Tim Van Patten <timvp@google.com>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
Fixes: f5d39b0208 ("freezer,sched: Rewrite core freezer logic")
Cc: stable@vger.kernel.org # v6.1+
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(backported from commit 9ec2d92673)

K2CI-Arch: None
Signed-off-by: k2ci <kernel-bot@kylinos.cn>
Change-Id: I022a1d013c22729eb04a3e3f1f7954a8bf7050fb
Reviewed-on: http://gerrit.kylin.com/c/klinux/+/88459
Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
2023-12-25 09:37:51 +08:00
..