aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Schermerhorn <lee.schermerhorn@hp.com>2005-10-29 21:15:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:36 -0400
commitc340010e4bf824d969a89fa192ecc7a526c0cd24 (patch)
treea459fba71b05b3b14dc1e32739cc2520dd0e57be
parentb57b98d147ef98758886a39efb94f3254542c39b (diff)
[PATCH] shrink_list(): skip anon pages if not may_swap
Martin Hicks' page cache reclaim patch added the 'may_swap' flag to the scan_control struct; and modified shrink_list() not to add anon pages to the swap cache if may_swap is not asserted. Ref: http://marc.theaimsgroup.com/?l=linux-mm&m=111461480725322&w=4 However, further down, if the page is mapped, shrink_list() calls try_to_unmap() which will call try_to_unmap_one() via try_to_unmap_anon (). try_to_unmap_one() will BUG_ON() an anon page that is NOT in the swap cache. Martin says he never encountered this path in his testing, but agrees that it might happen. This patch modifies shrink_list() to skip anon pages that are not already in the swap cache when !may_swap, rather than just not adding them to the cache. Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/vmscan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 843c87d1e61f..41d1064aabfb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -417,7 +417,9 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
417 * Anonymous process memory has backing store? 417 * Anonymous process memory has backing store?
418 * Try to allocate it some swap space here. 418 * Try to allocate it some swap space here.
419 */ 419 */
420 if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) { 420 if (PageAnon(page) && !PageSwapCache(page)) {
421 if (!sc->may_swap)
422 goto keep_locked;
421 if (!add_to_swap(page)) 423 if (!add_to_swap(page))
422 goto activate_locked; 424 goto activate_locked;
423 } 425 }