diff options
author | Rik van Riel <riel@redhat.com> | 2008-10-18 23:26:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:50:25 -0400 |
commit | 68a22394c286a2daf06ee8d65d8835f738faefa5 (patch) | |
tree | 1fb91d5bf57a1f6d1cabaac0a6f5d86060ebecb5 /mm/vmscan.c | |
parent | f04e9ebbe4909f9a41efd55149bc353299f4e83b (diff) |
vmscan: free swap space on swap-in/activation
If vm_swap_full() (swap space more than 50% full), the system will free
swap space at swapin time. With this patch, the system will also free the
swap space in the pageout code, when we decide that the page is not a
candidate for swapout (and just wasting swap space).
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Signed-off-by: MinChan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 46fdaa546b8d..e656035d3406 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -647,6 +647,9 @@ free_it: | |||
647 | continue; | 647 | continue; |
648 | 648 | ||
649 | activate_locked: | 649 | activate_locked: |
650 | /* Not a candidate for swapping, so reclaim swap space. */ | ||
651 | if (PageSwapCache(page) && vm_swap_full()) | ||
652 | remove_exclusive_swap_page_ref(page); | ||
650 | SetPageActive(page); | 653 | SetPageActive(page); |
651 | pgactivate++; | 654 | pgactivate++; |
652 | keep_locked: | 655 | keep_locked: |
@@ -1228,6 +1231,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
1228 | __mod_zone_page_state(zone, NR_ACTIVE, pgmoved); | 1231 | __mod_zone_page_state(zone, NR_ACTIVE, pgmoved); |
1229 | pgmoved = 0; | 1232 | pgmoved = 0; |
1230 | spin_unlock_irq(&zone->lru_lock); | 1233 | spin_unlock_irq(&zone->lru_lock); |
1234 | if (vm_swap_full()) | ||
1235 | pagevec_swap_free(&pvec); | ||
1231 | __pagevec_release(&pvec); | 1236 | __pagevec_release(&pvec); |
1232 | spin_lock_irq(&zone->lru_lock); | 1237 | spin_lock_irq(&zone->lru_lock); |
1233 | } | 1238 | } |
@@ -1237,6 +1242,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
1237 | __count_zone_vm_events(PGREFILL, zone, pgscanned); | 1242 | __count_zone_vm_events(PGREFILL, zone, pgscanned); |
1238 | __count_vm_events(PGDEACTIVATE, pgdeactivate); | 1243 | __count_vm_events(PGDEACTIVATE, pgdeactivate); |
1239 | spin_unlock_irq(&zone->lru_lock); | 1244 | spin_unlock_irq(&zone->lru_lock); |
1245 | if (vm_swap_full()) | ||
1246 | pagevec_swap_free(&pvec); | ||
1240 | 1247 | ||
1241 | pagevec_release(&pvec); | 1248 | pagevec_release(&pvec); |
1242 | } | 1249 | } |