aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorHonglei Wang <honglei.wang@oracle.com>2019-10-30 16:18:10 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-31 16:45:06 +0100
commit20832ebf91a654579c029ae627b961137ad47b1a (patch)
tree13c1c5392b7e62375848319236fb62ad4749df0a /kernel
parent2170f9d296c87f702391fb5614e08f67632a4cd6 (diff)
cgroup: freezer: don't change task and cgroups status unnecessarily
[ Upstream commit 742e8cd3e1ba6f19cad6d912f8d469df5557d0fd ] It's not necessary to adjust the task state and revisit the state of source and destination cgroups if the cgroups are not in freeze state and the task itself is not frozen. And in this scenario, it wakes up the task who's not supposed to be ready to run. Don't do the unnecessary task state adjustment can help stop waking up the task without a reason. Signed-off-by: Honglei Wang <honglei.wang@oracle.com> Acked-by: Roman Gushchin <guro@fb.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup/freezer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/cgroup/freezer.c b/kernel/cgroup/freezer.c
index 8cf0106806789..3984dd6b8ddbc 100644
--- a/kernel/cgroup/freezer.c
+++ b/kernel/cgroup/freezer.c
@@ -231,6 +231,15 @@ void cgroup_freezer_migrate_task(struct task_struct *task,
return;
/*
+ * It's not necessary to do changes if both of the src and dst cgroups
+ * are not freezing and task is not frozen.
+ */
+ if (!test_bit(CGRP_FREEZE, &src->flags) &&
+ !test_bit(CGRP_FREEZE, &dst->flags) &&
+ !task->frozen)
+ return;
+
+ /*
* Adjust counters of freezing and frozen tasks.
* Note, that if the task is frozen, but the destination cgroup is not
* frozen, we bump both counters to keep them balanced.