diff options
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r-- | kernel/power/process.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 7f0d4343af1b..5a6ec8678b9a 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -108,25 +108,27 @@ static int try_to_freeze_tasks(bool user_only) | |||
108 | return todo ? -EBUSY : 0; | 108 | return todo ? -EBUSY : 0; |
109 | } | 109 | } |
110 | 110 | ||
111 | static bool __check_frozen_processes(void) | ||
112 | { | ||
113 | struct task_struct *g, *p; | ||
114 | |||
115 | for_each_process_thread(g, p) | ||
116 | if (p != current && !freezer_should_skip(p) && !frozen(p)) | ||
117 | return false; | ||
118 | |||
119 | return true; | ||
120 | } | ||
121 | |||
111 | /* | 122 | /* |
112 | * Returns true if all freezable tasks (except for current) are frozen already | 123 | * Returns true if all freezable tasks (except for current) are frozen already |
113 | */ | 124 | */ |
114 | static bool check_frozen_processes(void) | 125 | static bool check_frozen_processes(void) |
115 | { | 126 | { |
116 | struct task_struct *g, *p; | 127 | bool ret; |
117 | bool ret = true; | ||
118 | 128 | ||
119 | read_lock(&tasklist_lock); | 129 | read_lock(&tasklist_lock); |
120 | for_each_process_thread(g, p) { | 130 | ret = __check_frozen_processes(); |
121 | if (p != current && !freezer_should_skip(p) && | ||
122 | !frozen(p)) { | ||
123 | ret = false; | ||
124 | goto done; | ||
125 | } | ||
126 | } | ||
127 | done: | ||
128 | read_unlock(&tasklist_lock); | 131 | read_unlock(&tasklist_lock); |
129 | |||
130 | return ret; | 132 | return ret; |
131 | } | 133 | } |
132 | 134 | ||
@@ -167,15 +169,14 @@ int freeze_processes(void) | |||
167 | * on the way out so we have to double check for race. | 169 | * on the way out so we have to double check for race. |
168 | */ | 170 | */ |
169 | if (oom_kills_count() != oom_kills_saved && | 171 | if (oom_kills_count() != oom_kills_saved && |
170 | !check_frozen_processes()) { | 172 | !check_frozen_processes()) { |
171 | __usermodehelper_set_disable_depth(UMH_ENABLED); | 173 | __usermodehelper_set_disable_depth(UMH_ENABLED); |
172 | printk("OOM in progress."); | 174 | printk("OOM in progress."); |
173 | error = -EBUSY; | 175 | error = -EBUSY; |
174 | goto done; | 176 | } else { |
177 | printk("done."); | ||
175 | } | 178 | } |
176 | printk("done."); | ||
177 | } | 179 | } |
178 | done: | ||
179 | printk("\n"); | 180 | printk("\n"); |
180 | BUG_ON(in_atomic()); | 181 | BUG_ON(in_atomic()); |
181 | 182 | ||