* [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem
@ 2005-12-04 22:46 Rafael J. Wysocki
2005-12-04 22:49 ` [PATCH 1/2][Fix][mm] swsusp: fix counting of highmem pages Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2005-12-04 22:46 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
Hi,
The following two patches are necessary to fix the way in which swsusp (in
the current -mm) handles highmem.
The patches have been acked by Pavel (Pavel, please confirm).
Please apply.
Greetings,
Rafael
--
Beer is proof that God loves us and wants us to be happy - Benjamin Franklin
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2][Fix][mm] swsusp: fix counting of highmem pages
2005-12-04 22:46 [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Rafael J. Wysocki
@ 2005-12-04 22:49 ` Rafael J. Wysocki
2005-12-04 23:00 ` [PATCH 2/2][Fix][mm] swsusp: fix enough_free_mem Rafael J. Wysocki
2005-12-04 23:41 ` [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Pavel Machek
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2005-12-04 22:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
This patch fixes a problem with swsusp that causes suspend to
fail on systems with the highmem zone, if many highmem pages are in use.
The patch makes swsusp count the non-free highmem pages in a correct way
and, consequently, release a sufficient amount of memory before suspend.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/swsusp.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.15-rc3-mm1/kernel/power/swsusp.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/kernel/power/swsusp.c 2005-12-04 14:24:10.000000000 +0100
+++ linux-2.6.15-rc3-mm1/kernel/power/swsusp.c 2005-12-04 14:42:08.000000000 +0100
@@ -635,7 +635,8 @@
printk("Shrinking memory... ");
do {
#ifdef FAST_FREE
- tmp = count_data_pages() + count_highmem_pages();
+ tmp = 2 * count_highmem_pages();
+ tmp += tmp / 50 + count_data_pages();
tmp += (tmp + PBES_PER_PAGE - 1) / PBES_PER_PAGE +
PAGES_FOR_IO;
for_each_zone (zone)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2][Fix][mm] swsusp: fix enough_free_mem
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
2005-12-04 23:41 ` [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Pavel Machek
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2005-12-04 23:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Pavel Machek
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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem
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 ` [PATCH 2/2][Fix][mm] swsusp: fix enough_free_mem Rafael J. Wysocki
@ 2005-12-04 23:41 ` Pavel Machek
2 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2005-12-04 23:41 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andrew Morton, LKML
Hi!
> The following two patches are necessary to fix the way in which swsusp (in
> the current -mm) handles highmem.
>
> The patches have been acked by Pavel (Pavel, please confirm).
ACK and thakns. (Sorry if you get this twice).
Pavel
--
Thanks, Sharp!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-12-04 23:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2][Fix][mm] swsusp: fix enough_free_mem Rafael J. Wysocki
2005-12-04 23:41 ` [PATCH 0/2][Fix][mm] swsusp: fix handling of highmem Pavel Machek
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®