aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup_freezer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cgroup_freezer.c')
-rw-r--r--kernel/cgroup_freezer.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 6e4280d77429..e95056954498 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -201,8 +201,8 @@ static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task)
201/* 201/*
202 * caller must hold freezer->lock 202 * caller must hold freezer->lock
203 */ 203 */
204static void check_if_frozen(struct cgroup *cgroup, 204static void update_freezer_state(struct cgroup *cgroup,
205 struct freezer *freezer) 205 struct freezer *freezer)
206{ 206{
207 struct cgroup_iter it; 207 struct cgroup_iter it;
208 struct task_struct *task; 208 struct task_struct *task;
@@ -222,6 +222,10 @@ static void check_if_frozen(struct cgroup *cgroup,
222 */ 222 */
223 if (nfrozen == ntotal) 223 if (nfrozen == ntotal)
224 freezer->state = CGROUP_FROZEN; 224 freezer->state = CGROUP_FROZEN;
225 else if (nfrozen > 0)
226 freezer->state = CGROUP_FREEZING;
227 else
228 freezer->state = CGROUP_THAWED;
225 cgroup_iter_end(cgroup, &it); 229 cgroup_iter_end(cgroup, &it);
226} 230}
227 231
@@ -240,7 +244,7 @@ static int freezer_read(struct cgroup *cgroup, struct cftype *cft,
240 if (state == CGROUP_FREEZING) { 244 if (state == CGROUP_FREEZING) {
241 /* We change from FREEZING to FROZEN lazily if the cgroup was 245 /* We change from FREEZING to FROZEN lazily if the cgroup was
242 * only partially frozen when we exitted write. */ 246 * only partially frozen when we exitted write. */
243 check_if_frozen(cgroup, freezer); 247 update_freezer_state(cgroup, freezer);
244 state = freezer->state; 248 state = freezer->state;
245 } 249 }
246 spin_unlock_irq(&freezer->lock); 250 spin_unlock_irq(&freezer->lock);
@@ -301,7 +305,7 @@ static int freezer_change_state(struct cgroup *cgroup,
301 305
302 freezer = cgroup_freezer(cgroup); 306 freezer = cgroup_freezer(cgroup);
303 spin_lock_irq(&freezer->lock); 307 spin_lock_irq(&freezer->lock);
304 check_if_frozen(cgroup, freezer); /* may update freezer->state */ 308 update_freezer_state(cgroup, freezer);
305 if (goal_state == freezer->state) 309 if (goal_state == freezer->state)
306 goto out; 310 goto out;
307 switch (freezer->state) { 311 switch (freezer->state) {