mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
cgroup: freezer: don't change task and cgroups status unnecessarily
[ Upstream commit 742e8cd3e1
]
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>
This commit is contained in:
parent
2170f9d296
commit
20832ebf91
1 changed files with 9 additions and 0 deletions
|
@ -230,6 +230,15 @@ void cgroup_freezer_migrate_task(struct task_struct *task,
|
|||
if (task->flags & PF_KTHREAD)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue