PM/Hibernate: Fix memory shrinking
authorRafael J. Wysocki <rjw@sisk.pl>
Sat, 18 Apr 2009 15:23:41 +0000 (17:23 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Apr 2009 18:36:58 +0000 (11:36 -0700)
Commit d979677c4c0 ("mm: shrink_all_memory(): use sc.nr_reclaimed")
broke the memory shrinking used by hibernation, becuse it did not update
shrink_all_zones() in accordance with the other changes it made.

Fix this by making shrink_all_zones() update sc->nr_reclaimed instead of
overwriting its value.

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=13058

Reported-and-tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmscan.c

index 39fdfb14eeaa7c986ac6edf282ab0fec382a0e66..99155b7b8123fc312d3d38869a179d9b3e4ab1eb 100644 (file)
@@ -2088,13 +2088,13 @@ static void shrink_all_zones(unsigned long nr_pages, int prio,
                                nr_reclaimed += shrink_list(l, nr_to_scan, zone,
                                                                sc, prio);
                                if (nr_reclaimed >= nr_pages) {
-                                       sc->nr_reclaimed = nr_reclaimed;
+                                       sc->nr_reclaimed += nr_reclaimed;
                                        return;
                                }
                        }
                }
        }
-       sc->nr_reclaimed = nr_reclaimed;
+       sc->nr_reclaimed += nr_reclaimed;
 }
 
 /*
@@ -2115,6 +2115,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
                .may_unmap = 0,
                .may_writepage = 1,
                .isolate_pages = isolate_pages_global,
+               .nr_reclaimed = 0,
        };
 
        current->reclaim_state = &reclaim_state;