diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/process.c | 19 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 3 | ||||
-rw-r--r-- | kernel/power/user.c | 9 |
3 files changed, 30 insertions, 1 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 77274c9ba2f1..eeca00311f39 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -188,3 +188,22 @@ void thaw_processes(void) | |||
188 | printk("done.\n"); | 188 | printk("done.\n"); |
189 | } | 189 | } |
190 | 190 | ||
191 | void thaw_kernel_threads(void) | ||
192 | { | ||
193 | struct task_struct *g, *p; | ||
194 | |||
195 | pm_nosig_freezing = false; | ||
196 | printk("Restarting kernel threads ... "); | ||
197 | |||
198 | thaw_workqueues(); | ||
199 | |||
200 | read_lock(&tasklist_lock); | ||
201 | do_each_thread(g, p) { | ||
202 | if (p->flags & (PF_KTHREAD | PF_WQ_WORKER)) | ||
203 | __thaw_task(p); | ||
204 | } while_each_thread(g, p); | ||
205 | read_unlock(&tasklist_lock); | ||
206 | |||
207 | schedule(); | ||
208 | printk("done.\n"); | ||
209 | } | ||
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 1cf88900ec4f..6a768e537001 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -812,7 +812,8 @@ unsigned int snapshot_additional_pages(struct zone *zone) | |||
812 | unsigned int res; | 812 | unsigned int res; |
813 | 813 | ||
814 | res = DIV_ROUND_UP(zone->spanned_pages, BM_BITS_PER_BLOCK); | 814 | res = DIV_ROUND_UP(zone->spanned_pages, BM_BITS_PER_BLOCK); |
815 | res += DIV_ROUND_UP(res * sizeof(struct bm_block), PAGE_SIZE); | 815 | res += DIV_ROUND_UP(res * sizeof(struct bm_block), |
816 | LINKED_PAGE_DATA_SIZE); | ||
816 | return 2 * res; | 817 | return 2 * res; |
817 | } | 818 | } |
818 | 819 | ||
diff --git a/kernel/power/user.c b/kernel/power/user.c index 6b1ab7a88522..e5a21a857302 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -274,6 +274,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
274 | swsusp_free(); | 274 | swsusp_free(); |
275 | memset(&data->handle, 0, sizeof(struct snapshot_handle)); | 275 | memset(&data->handle, 0, sizeof(struct snapshot_handle)); |
276 | data->ready = 0; | 276 | data->ready = 0; |
277 | /* | ||
278 | * It is necessary to thaw kernel threads here, because | ||
279 | * SNAPSHOT_CREATE_IMAGE may be invoked directly after | ||
280 | * SNAPSHOT_FREE. In that case, if kernel threads were not | ||
281 | * thawed, the preallocation of memory carried out by | ||
282 | * hibernation_snapshot() might run into problems (i.e. it | ||
283 | * might fail or even deadlock). | ||
284 | */ | ||
285 | thaw_kernel_threads(); | ||
277 | break; | 286 | break; |
278 | 287 | ||
279 | case SNAPSHOT_PREF_IMAGE_SIZE: | 288 | case SNAPSHOT_PREF_IMAGE_SIZE: |