Commit 51308ee5 authored by Li Zefan's avatar Li Zefan Committed by Linus Torvalds

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: default avatarLi Zefan <lizf@cn.fujitsu.com>
Acked-by: default avatarCedric Le Goater <clg@fr.ibm.com>
Acked-by: default avatarMatt Helsley <matthltc@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 00c2e63c
......@@ -296,27 +296,22 @@ static int freezer_change_state(struct cgroup *cgroup,
int retval = 0;
freezer = cgroup_freezer(cgroup);
spin_lock_irq(&freezer->lock);
update_freezer_state(cgroup, freezer);
if (goal_state == freezer->state)
goto out;
switch (freezer->state) {
switch (goal_state) {
case CGROUP_THAWED:
retval = try_to_freeze_cgroup(cgroup, freezer);
unfreeze_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);
retval = try_to_freeze_cgroup(cgroup, freezer);
break;
default:
break;
BUG();
}
out:
spin_unlock_irq(&freezer->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment