mirror of https://gitee.com/openkylin/linux.git
freezer_cg: simplify freezer_change_state()
Just call unfreeze_cgroup() if goal_state == THAWED, and call try_to_freeze_cgroup() if goal_state == FROZEN. No behavior has been changed. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Cedric Le Goater <clg@fr.ibm.com> Acked-by: Matt Helsley <matthltc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
00c2e63c31
commit
51308ee59d
|
@ -296,27 +296,22 @@ static int freezer_change_state(struct cgroup *cgroup,
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
freezer = cgroup_freezer(cgroup);
|
freezer = cgroup_freezer(cgroup);
|
||||||
|
|
||||||
spin_lock_irq(&freezer->lock);
|
spin_lock_irq(&freezer->lock);
|
||||||
|
|
||||||
update_freezer_state(cgroup, freezer);
|
update_freezer_state(cgroup, freezer);
|
||||||
if (goal_state == freezer->state)
|
if (goal_state == freezer->state)
|
||||||
goto out;
|
goto out;
|
||||||
switch (freezer->state) {
|
|
||||||
|
switch (goal_state) {
|
||||||
case CGROUP_THAWED:
|
case CGROUP_THAWED:
|
||||||
retval = try_to_freeze_cgroup(cgroup, freezer);
|
|
||||||
break;
|
|
||||||
case CGROUP_FREEZING:
|
|
||||||
if (goal_state == CGROUP_FROZEN) {
|
|
||||||
/* Userspace is retrying after
|
|
||||||
* "/bin/echo FROZEN > freezer.state" returned -EBUSY */
|
|
||||||
retval = try_to_freeze_cgroup(cgroup, freezer);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* state == FREEZING and goal_state == THAWED, so unfreeze */
|
|
||||||
case CGROUP_FROZEN:
|
|
||||||
unfreeze_cgroup(cgroup, freezer);
|
unfreeze_cgroup(cgroup, freezer);
|
||||||
break;
|
break;
|
||||||
default:
|
case CGROUP_FROZEN:
|
||||||
|
retval = try_to_freeze_cgroup(cgroup, freezer);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
BUG();
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
spin_unlock_irq(&freezer->lock);
|
spin_unlock_irq(&freezer->lock);
|
||||||
|
|
Loading…
Reference in New Issue