From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Pavel Machek <pavel@suse.cz>
Subject: [PATCH 2/2][Fix][mm] swsusp: fix enough_free_mem
Date: Mon, 5 Dec 2005 00:00:35 +0100 [thread overview]
Message-ID: <200512050000.35842.rjw@sisk.pl> (raw)
In-Reply-To: <200512042346.11731.rjw@sisk.pl>
This patch fixes a problem with the function enough_free_mem() used by
swsusp to verify if there is a sufficient number of memory pages available to
it to create and save the suspend image.
Namely, enough_free_mem() uses nr_free_pages() to obtain the number
of free memory pages, which is incorrect, because this function returns the
total number of free pages, including free highmem pages, and the highmem
pages cannot be used by swsusp for storing the image data.
The patch makes enough_free_mem() avoid counting the free highmem
pages as available to swsusp.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/snapshot.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
Index: linux-2.6.15-rc3-mm1/kernel/power/snapshot.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/kernel/power/snapshot.c 2005-12-04 14:24:10.000000000 +0100
+++ linux-2.6.15-rc3-mm1/kernel/power/snapshot.c 2005-12-04 14:38:58.000000000 +0100
@@ -437,8 +437,14 @@
static int enough_free_mem(unsigned int nr_pages)
{
- pr_debug("swsusp: available memory: %u pages\n", nr_free_pages());
- return nr_free_pages() > (nr_pages + PAGES_FOR_IO +
+ struct zone *zone;
+ unsigned int n = 0;
+
+ for_each_zone (zone)
+ if (!is_highmem(zone))
+ n += zone->free_pages;
+ pr_debug("swsusp: available memory: %u pages\n", n);
+ return n > (nr_pages + PAGES_FOR_IO +
(nr_pages + PBES_PER_PAGE - 1) / PBES_PER_PAGE);
}
next prev parent reply other threads:[~2005-12-04 23:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-04 22:46 [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Rafael J. Wysocki
2005-12-04 22:49 ` [PATCH 1/2][Fix][mm] swsusp: fix counting of highmem pages Rafael J. Wysocki
2005-12-04 23:00 ` Rafael J. Wysocki [this message]
2005-12-04 23:41 ` [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Pavel Machek
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=200512050000.35842.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
/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®