Skip to content

Commit

Permalink
PM/Hibernate: Fix memory shrinking
Browse files Browse the repository at this point in the history
Commit d979677 ("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>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Apr 18, 2009
1 parent aefe647 commit a21e255
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand All @@ -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;
Expand Down

0 comments on commit a21e255

Please sign in to comment.