swsusp: fix nr_copy_pages
Subsystems (2)
PATCH 3/3 swsusp: fix nr_copy_pages
The following patch moves the recalculation of nr_copy_pages so that the right number is used in the calculation of the size of memory and swap needed.
It prevents swsusp from attempting to suspend if there is not enough memory and/or swap (which is unlikely anyway).
Signed-off-by Rafael J. Wysocki <[email protected]>
Signed-off-by Pavel Machek <[email protected]>
kernel/power/swsusp.c (mode:100644 sha1:880a42b1dd1bee261ea61bee2a3cb839df1ef1d0) renamed from kernel/power/swsusp.c (mode:100644 sha1:c3bf8c03c883657ff6bc5237868fe9a6494372e4) +3 -3
@@ -781,18 +781,18 @@ { int error; + pagedir_nosave = NULL; + nr_copy_pages = calc_nr(nr_copy_pages); + pr_debug("suspend: (pages needed: %d + %d free: %d)\n", nr_copy_pages, PAGES_FOR_IO, nr_free_pages()); - pagedir_nosave = NULL; if (!enough_free_mem()) return -ENOMEM; if (!enough_swap()) return -ENOSPC; - nr_copy_pages = calc_nr(nr_copy_pages); - if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) { printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); return -ENOMEM;
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.