On Wed, Aug 31, 2011 at 12:21:07PM +0200, Tejun Heo wrote: > d02f52811d0e "cgroup_freezer: prepare for removal of TIF_FREEZE" moved > setting of freezer->state into freezer_change_state(); unfortunately, > while doing so, when it's beginning to freeze tasks, it sets the state > to CGROUP_FROZEN instead of CGROUP_FREEZING ending up skipping the > whole freezing state. Fix it. > > -v2: Oleg pointed out that re-freezing FROZEN cgroup could increment > system_freezing_cnt. Fixed. > > Signed-off-by: Tejun Heo <tj@xxxxxxxxxx> > Reported-by: Oleg Nesterov <oleg@xxxxxxxxxx> > Cc: Paul Menage <paul@xxxxxxxxxxxxxx> > Cc: "Rafael J. Wysocki" <rjw@xxxxxxx> > --- > I'm in the process of moving and can only use a quite old laptop. I > tested compile but couldn't really do much else, so please proceed > with caution. Oleg, can you please ack the patches if you agree with > the updated versions? > > Thanks. > > kernel/cgroup_freezer.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > Index: work/kernel/cgroup_freezer.c > =================================================================== > --- work.orig/kernel/cgroup_freezer.c > +++ work/kernel/cgroup_freezer.c > @@ -308,24 +308,26 @@ static int freezer_change_state(struct c > spin_lock_irq(&freezer->lock); > > update_if_frozen(cgroup, freezer); > - if (goal_state == freezer->state) > - goto out; > - > - freezer->state = goal_state; > > switch (goal_state) { > case CGROUP_THAWED: > - atomic_dec(&system_freezing_cnt); > - unfreeze_cgroup(cgroup, freezer); > + if (freezer->state != CGROUP_THAWED) { > + freezer->state = CGROUP_THAWED; > + atomic_dec(&system_freezing_cnt); > + unfreeze_cgroup(cgroup, freezer); > + } > break; > case CGROUP_FROZEN: > - atomic_inc(&system_freezing_cnt); > - retval = try_to_freeze_cgroup(cgroup, freezer); > + if (freezer->state == CGROUP_THAWED) { > + freezer->state = CGROUP_FREEZING; > + atomic_inc(&system_freezing_cnt); > + retval = try_to_freeze_cgroup(cgroup, freezer); This still doesn't look quite right. If the cgroup is FREEZING it should also call try_to_freeze_cgroup(). I think this is what's needed: if (freezer->state == CGROUP_THAWED) atomic_inc(&system_freezing_cnt); freezer->state = CGROUP_FREEZING; retval = try_to_freeze_cgroup(cgroup, freezer); > + } > break; > default: > BUG(); > } Cheers, -Matt Helsley _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm