mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Andrew Morton <akpm@zip.com.au>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: [patch 3/3] swsusp: fix nr_copy_pages
Date: Tue, 26 Apr 2005 12:46:23 +0200	[thread overview]
Message-ID: <20050426104623.GA18028@elf.ucw.cz> (raw)

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>

Index: kernel/power/swsusp.c
===================================================================
--- d8c41efce19593001c280a07cde0506788b4347d/kernel/power/swsusp.c  (mode:100644 sha1:c3bf8c03c883657ff6bc5237868fe9a6494372e4)
+++ 692e5ecfee912a0752ee685f9f757911040f6750/kernel/power/swsusp.c  (mode:100644 sha1:880a42b1dd1bee261ea61bee2a3cb839df1ef1d0)
@@ -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;



-- 
Boycott Kodak -- for their patent abuse against Java.

                 reply	other threads:[~2005-04-26 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050426104623.GA18028@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®