提交 51308ee5 编写于 作者: L Li Zefan 提交者: 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: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NCedric Le Goater <clg@fr.ibm.com>
Acked-by: NMatt Helsley <matthltc@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 00c2e63c
...@@ -296,27 +296,22 @@ static int freezer_change_state(struct cgroup *cgroup, ...@@ -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); unfreeze_cgroup(cgroup, freezer);
break; 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: case CGROUP_FROZEN:
unfreeze_cgroup(cgroup, freezer); retval = try_to_freeze_cgroup(cgroup, freezer);
break; break;
default: default:
break; BUG();
} }
out: out:
spin_unlock_irq(&freezer->lock); spin_unlock_irq(&freezer->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册