aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/freezer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/freezer.c')
-rw-r--r--kernel/freezer.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/kernel/freezer.c b/kernel/freezer.c
index b83c30e9483a..c851d588e29f 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -145,18 +145,8 @@ void cancel_freezing(struct task_struct *p)
145 } 145 }
146} 146}
147 147
148static int __thaw_process(struct task_struct *p)
149{
150 if (frozen(p)) {
151 p->flags &= ~PF_FROZEN;
152 return 1;
153 }
154 clear_freeze_flag(p);
155 return 0;
156}
157
158/* 148/*
159 * Wake up a frozen process 149 * Wake up a frozen task
160 * 150 *
161 * task_lock() is needed to prevent the race with refrigerator() which may 151 * task_lock() is needed to prevent the race with refrigerator() which may
162 * occur if the freezing of tasks fails. Namely, without the lock, if the 152 * occur if the freezing of tasks fails. Namely, without the lock, if the
@@ -164,15 +154,18 @@ static int __thaw_process(struct task_struct *p)
164 * refrigerator() could call frozen_process(), in which case the task would be 154 * refrigerator() could call frozen_process(), in which case the task would be
165 * frozen and no one would thaw it. 155 * frozen and no one would thaw it.
166 */ 156 */
167int thaw_process(struct task_struct *p) 157void __thaw_task(struct task_struct *p)
168{ 158{
159 bool was_frozen;
160
169 task_lock(p); 161 task_lock(p);
170 if (__thaw_process(p) == 1) { 162 was_frozen = frozen(p);
171 task_unlock(p); 163 if (was_frozen)
172 wake_up_process(p); 164 p->flags &= ~PF_FROZEN;
173 return 1; 165 else
174 } 166 clear_freeze_flag(p);
175 task_unlock(p); 167 task_unlock(p);
176 return 0; 168
169 if (was_frozen)
170 wake_up_process(p);
177} 171}
178EXPORT_SYMBOL(thaw_process);