aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/process.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 088419387388..02e490e311eb 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -37,10 +37,18 @@ void refrigerator(void)
37 /* Hmm, should we be allowed to suspend when there are realtime 37 /* Hmm, should we be allowed to suspend when there are realtime
38 processes around? */ 38 processes around? */
39 long save; 39 long save;
40
41 task_lock(current);
42 if (freezing(current)) {
43 frozen_process(current);
44 task_unlock(current);
45 } else {
46 task_unlock(current);
47 return;
48 }
40 save = current->state; 49 save = current->state;
41 pr_debug("%s entered refrigerator\n", current->comm); 50 pr_debug("%s entered refrigerator\n", current->comm);
42 51
43 frozen_process(current);
44 spin_lock_irq(&current->sighand->siglock); 52 spin_lock_irq(&current->sighand->siglock);
45 recalc_sigpending(); /* We sent fake signal, clean it up */ 53 recalc_sigpending(); /* We sent fake signal, clean it up */
46 spin_unlock_irq(&current->sighand->siglock); 54 spin_unlock_irq(&current->sighand->siglock);
@@ -152,10 +160,12 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
152 if (is_user_space(p) == !freeze_user_space) 160 if (is_user_space(p) == !freeze_user_space)
153 continue; 161 continue;
154 162
163 task_lock(p);
155 if (freezeable(p) && !frozen(p)) 164 if (freezeable(p) && !frozen(p))
156 printk(KERN_ERR " %s\n", p->comm); 165 printk(KERN_ERR " %s\n", p->comm);
157 166
158 cancel_freezing(p); 167 cancel_freezing(p);
168 task_unlock(p);
159 } while_each_thread(g, p); 169 } while_each_thread(g, p);
160 read_unlock(&tasklist_lock); 170 read_unlock(&tasklist_lock);
161 } 171 }