[PATCH] swsusp: fix memory shrinker
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 5 Apr 2007 02:08:21 +0000 (19:08 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 5 Apr 2007 04:12:47 +0000 (21:12 -0700)
Fix a bug in the swsusp's memory shrinker that causes some systems using
highmem to refuse to suspend to disk if image_size is set above 1/2 of
available RAM.

Special thanks to Jiri Slaby for reporting the problem and assistance in
debugging it.

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

index 7fb834397a0d5f97701f0e604b138cb473647011..175370824f3720517d72fc7814a9227b29680dd3 100644 (file)
@@ -229,13 +229,13 @@ int swsusp_shrink_memory(void)
                size += highmem_size;
                for_each_zone (zone)
                        if (populated_zone(zone)) {
+                               tmp += snapshot_additional_pages(zone);
                                if (is_highmem(zone)) {
                                        highmem_size -=
                                        zone_page_state(zone, NR_FREE_PAGES);
                                } else {
                                        tmp -= zone_page_state(zone, NR_FREE_PAGES);
                                        tmp += zone->lowmem_reserve[ZONE_NORMAL];
-                                       tmp += snapshot_additional_pages(zone);
                                }
                        }