diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2008-10-29 17:00:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-30 14:38:45 -0400 |
commit | 51308ee59dee1136ed599d875ea8968d7be55c91 (patch) | |
tree | 8976509c5fbf8171774e7eb7007cf0d4d00f0f83 | |
parent | 00c2e63c31d0f431952ff2a671c5c6997dd4f8b2 (diff) |
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>
-rw-r--r-- | kernel/cgroup_freezer.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 5e6d26b66e88..7fa476f01d05 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -296,27 +296,22 @@ static int freezer_change_state(struct cgroup *cgroup, | |||
296 | int retval = 0; | 296 | int retval = 0; |
297 | 297 | ||
298 | freezer = cgroup_freezer(cgroup); | 298 | freezer = cgroup_freezer(cgroup); |
299 | |||
299 | spin_lock_irq(&freezer->lock); | 300 | spin_lock_irq(&freezer->lock); |
301 | |||
300 | update_freezer_state(cgroup, freezer); | 302 | update_freezer_state(cgroup, freezer); |
301 | if (goal_state == freezer->state) | 303 | if (goal_state == freezer->state) |
302 | goto out; | 304 | goto out; |
303 | switch (freezer->state) { | 305 | |
306 | switch (goal_state) { | ||
304 | case CGROUP_THAWED: | 307 | case CGROUP_THAWED: |
305 | retval = try_to_freeze_cgroup(cgroup, freezer); | 308 | unfreeze_cgroup(cgroup, freezer); |
306 | break; | 309 | break; |
307 | case CGROUP_FREEZING: | ||
308 | if (goal_state == CGROUP_FROZEN) { | ||
309 | /* Userspace is retrying after | ||
310 | * "/bin/echo FROZEN > freezer.state" returned -EBUSY */ | ||
311 | retval = try_to_freeze_cgroup(cgroup, freezer); | ||
312 | break; | ||
313 | } | ||
314 | /* state == FREEZING and goal_state == THAWED, so unfreeze */ | ||
315 | case CGROUP_FROZEN: | 310 | case CGROUP_FROZEN: |
316 | unfreeze_cgroup(cgroup, freezer); | 311 | retval = try_to_freeze_cgroup(cgroup, freezer); |
317 | break; | 312 | break; |
318 | default: | 313 | default: |
319 | break; | 314 | BUG(); |
320 | } | 315 | } |
321 | out: | 316 | out: |
322 | spin_unlock_irq(&freezer->lock); | 317 | spin_unlock_irq(&freezer->lock); |