diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index c62cadce0426..6379ddbffd9b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -74,6 +74,9 @@ struct scan_control { | |||
74 | 74 | ||
75 | int may_writepage; | 75 | int may_writepage; |
76 | 76 | ||
77 | /* Can pages be swapped as part of reclaim? */ | ||
78 | int may_swap; | ||
79 | |||
77 | /* This context's SWAP_CLUSTER_MAX. If freeing memory for | 80 | /* This context's SWAP_CLUSTER_MAX. If freeing memory for |
78 | * suspend, we effectively ignore SWAP_CLUSTER_MAX. | 81 | * suspend, we effectively ignore SWAP_CLUSTER_MAX. |
79 | * In this context, it doesn't matter that we scan the | 82 | * In this context, it doesn't matter that we scan the |
@@ -414,7 +417,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) | |||
414 | * Anonymous process memory has backing store? | 417 | * Anonymous process memory has backing store? |
415 | * Try to allocate it some swap space here. | 418 | * Try to allocate it some swap space here. |
416 | */ | 419 | */ |
417 | if (PageAnon(page) && !PageSwapCache(page)) { | 420 | if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) { |
418 | if (!add_to_swap(page)) | 421 | if (!add_to_swap(page)) |
419 | goto activate_locked; | 422 | goto activate_locked; |
420 | } | 423 | } |
@@ -927,6 +930,7 @@ int try_to_free_pages(struct zone **zones, | |||
927 | 930 | ||
928 | sc.gfp_mask = gfp_mask; | 931 | sc.gfp_mask = gfp_mask; |
929 | sc.may_writepage = 0; | 932 | sc.may_writepage = 0; |
933 | sc.may_swap = 1; | ||
930 | 934 | ||
931 | inc_page_state(allocstall); | 935 | inc_page_state(allocstall); |
932 | 936 | ||
@@ -1027,6 +1031,7 @@ loop_again: | |||
1027 | total_reclaimed = 0; | 1031 | total_reclaimed = 0; |
1028 | sc.gfp_mask = GFP_KERNEL; | 1032 | sc.gfp_mask = GFP_KERNEL; |
1029 | sc.may_writepage = 0; | 1033 | sc.may_writepage = 0; |
1034 | sc.may_swap = 1; | ||
1030 | sc.nr_mapped = read_page_state(nr_mapped); | 1035 | sc.nr_mapped = read_page_state(nr_mapped); |
1031 | 1036 | ||
1032 | inc_page_state(pageoutrun); | 1037 | inc_page_state(pageoutrun); |