[PATCH] swsusp: take lowmem reserves into account
authorRafael J. Wysocki <rjw@sisk.pl>
Fri, 23 Jun 2006 09:04:46 +0000 (02:04 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Jun 2006 14:42:59 +0000 (07:42 -0700)
swsusp allocates memory from the normal zone, so it cannot use lowmem
reserve pages from the lower zones.  Therefore it should not count these
pages as available to it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/swsusp.c

index 78b6e71b08131ad1a3d3cbec25d1a79f2d4e26f4..f0ee4e7780d66d95cce50199a1c2ebee00cbe9b0 100644 (file)
@@ -188,8 +188,10 @@ int swsusp_shrink_memory(void)
                        PAGES_FOR_IO;
                tmp = size;
                for_each_zone (zone)
-                       if (!is_highmem(zone))
+                       if (!is_highmem(zone) && populated_zone(zone)) {
                                tmp -= zone->free_pages;
+                               tmp += zone->lowmem_reserve[ZONE_NORMAL];
+                       }
                if (tmp > 0) {
                        tmp = __shrink_memory(tmp);
                        if (!tmp)