aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/freezer.h7
-rw-r--r--kernel/cgroup_freezer.c9
-rw-r--r--kernel/power/process.c5
3 files changed, 13 insertions, 8 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 5a361f85cfec..da7e52b099f3 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -64,9 +64,12 @@ extern bool freeze_task(struct task_struct *p, bool sig_only);
64extern void cancel_freezing(struct task_struct *p); 64extern void cancel_freezing(struct task_struct *p);
65 65
66#ifdef CONFIG_CGROUP_FREEZER 66#ifdef CONFIG_CGROUP_FREEZER
67extern int cgroup_frozen(struct task_struct *task); 67extern int cgroup_freezing_or_frozen(struct task_struct *task);
68#else /* !CONFIG_CGROUP_FREEZER */ 68#else /* !CONFIG_CGROUP_FREEZER */
69static inline int cgroup_frozen(struct task_struct *task) { return 0; } 69static inline int cgroup_freezing_or_frozen(struct task_struct *task)
70{
71 return 0;
72}
70#endif /* !CONFIG_CGROUP_FREEZER */ 73#endif /* !CONFIG_CGROUP_FREEZER */
71 74
72/* 75/*
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 59e9ef6aab40..eb3f34d57419 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -47,17 +47,20 @@ static inline struct freezer *task_freezer(struct task_struct *task)
47 struct freezer, css); 47 struct freezer, css);
48} 48}
49 49
50int cgroup_frozen(struct task_struct *task) 50int cgroup_freezing_or_frozen(struct task_struct *task)
51{ 51{
52 struct freezer *freezer; 52 struct freezer *freezer;
53 enum freezer_state state; 53 enum freezer_state state;
54 54
55 task_lock(task); 55 task_lock(task);
56 freezer = task_freezer(task); 56 freezer = task_freezer(task);
57 state = freezer->state; 57 if (!freezer->css.cgroup->parent)
58 state = CGROUP_THAWED; /* root cgroup can't be frozen */
59 else
60 state = freezer->state;
58 task_unlock(task); 61 task_unlock(task);
59 62
60 return state == CGROUP_FROZEN; 63 return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN);
61} 64}
62 65
63/* 66/*
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 5ade1bdcf366..71ae29052ab6 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -88,12 +88,11 @@ static int try_to_freeze_tasks(bool sig_only)
88 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds " 88 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
89 "(%d tasks refusing to freeze):\n", 89 "(%d tasks refusing to freeze):\n",
90 elapsed_csecs / 100, elapsed_csecs % 100, todo); 90 elapsed_csecs / 100, elapsed_csecs % 100, todo);
91 show_state();
92 read_lock(&tasklist_lock); 91 read_lock(&tasklist_lock);
93 do_each_thread(g, p) { 92 do_each_thread(g, p) {
94 task_lock(p); 93 task_lock(p);
95 if (freezing(p) && !freezer_should_skip(p)) 94 if (freezing(p) && !freezer_should_skip(p))
96 printk(KERN_ERR " %s\n", p->comm); 95 sched_show_task(p);
97 cancel_freezing(p); 96 cancel_freezing(p);
98 task_unlock(p); 97 task_unlock(p);
99 } while_each_thread(g, p); 98 } while_each_thread(g, p);
@@ -145,7 +144,7 @@ static void thaw_tasks(bool nosig_only)
145 if (nosig_only && should_send_signal(p)) 144 if (nosig_only && should_send_signal(p))
146 continue; 145 continue;
147 146
148 if (cgroup_frozen(p)) 147 if (cgroup_freezing_or_frozen(p))
149 continue; 148 continue;
150 149
151 thaw_process(p); 150 thaw_process(p);