lkml.org 
[lkml]   [2008]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 4/4] freezer_cg: simplify freezer_change_state()
    From
    Date
    On Tue, 2008-10-21 at 08:52 +0800, Li Zefan wrote:
    > Just call unfreeze_cgroup() if goal_state == THAWED, and call
    > try_to_freeze_cgroup() if goal_state == FROZEN.
    >
    > No behavior has been changed.

    Another good one. Thanks!

    Acked-by: Matt Helsley <matthltc@us.ibm.com>

    > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
    > ---
    > 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 3ea57e4..cdef2d8 100644
    > --- a/kernel/cgroup_freezer.c
    > +++ b/kernel/cgroup_freezer.c
    > @@ -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);



    \
     
     \ /
      Last update: 2008-10-21 23:49    [W:0.022 / U:30.184 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site