mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Signed-off-by: Lee Schermerhorn <[email protected]> Signed-off-by: MinChan Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f04e9ebbe4
commit
68a22394c2
5 changed files with 60 additions and 3 deletions
|
|
@ -647,6 +647,9 @@ free_it:
|
|||
continue;
|
||||
|
||||
activate_locked:
|
||||
/* Not a candidate for swapping, so reclaim swap space. */
|
||||
if (PageSwapCache(page) && vm_swap_full())
|
||||
remove_exclusive_swap_page_ref(page);
|
||||
SetPageActive(page);
|
||||
pgactivate++;
|
||||
keep_locked:
|
||||
|
|
@ -1228,6 +1231,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
|
|||
__mod_zone_page_state(zone, NR_ACTIVE, pgmoved);
|
||||
pgmoved = 0;
|
||||
spin_unlock_irq(&zone->lru_lock);
|
||||
if (vm_swap_full())
|
||||
pagevec_swap_free(&pvec);
|
||||
__pagevec_release(&pvec);
|
||||
spin_lock_irq(&zone->lru_lock);
|
||||
}
|
||||
|
|
@ -1237,6 +1242,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
|
|||
__count_zone_vm_events(PGREFILL, zone, pgscanned);
|
||||
__count_vm_events(PGDEACTIVATE, pgdeactivate);
|
||||
spin_unlock_irq(&zone->lru_lock);
|
||||
if (vm_swap_full())
|
||||
pagevec_swap_free(&pvec);
|
||||
|
||||
pagevec_release(&pvec);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue