summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPavel Machek2005-06-25 23:55:14 +0200
committerLinus Torvalds2005-06-26 01:24:33 +0200
commitc61978b30322c83a94d7e4857fa5b9996b7d7931 (patch)
tree34fe94d8b55738a957472de21a098a588f171d6a /kernel
parent[PATCH] swsusp: cleanup whitespace (diff)
downloadkernel-qcow2-linux-c61978b30322c83a94d7e4857fa5b9996b7d7931.tar.gz
kernel-qcow2-linux-c61978b30322c83a94d7e4857fa5b9996b7d7931.tar.xz
kernel-qcow2-linux-c61978b30322c83a94d7e4857fa5b9996b7d7931.zip
[PATCH] 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 <rjw@sisk.pl> Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/swsusp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 9a3ca659a436..c285fc5a2320 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -781,18 +781,18 @@ static int swsusp_alloc(void)
{
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;