From 1bbb1949d7e25c69ecda368cc0b8b2e4e893e5ce Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 31 Oct 2002 04:09:31 -0800 Subject: [PATCH] exempt swapcahe pages from "use once" handling The kernel will presently reclaim swapcache pages as they come off the tail of the inactive list even if they are referenced. That's the "use-once" pagecache path and shouldn't be applied to swapcache pages. This affects very few pages in practice because all those pages tend to be mapped into pagetables anyway. --- mm/vmscan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 1a47b52efd02..a2ae04f94ee7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -166,7 +166,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask) } /* Must be called with page's pte_chain_lock held. */ -static inline int page_mapping_inuse(struct page * page) +static inline int page_mapping_inuse(struct page *page) { struct address_space *mapping = page->mapping; @@ -178,8 +178,14 @@ static inline int page_mapping_inuse(struct page * page) if (!mapping) return 0; + /* Be more reluctant to reclaim swapcache than pagecache */ + if (PageSwapCache(page)) + return 1; + /* File is mmap'd by somebody. */ - if (!list_empty(&mapping->i_mmap) || !list_empty(&mapping->i_mmap_shared)) + if (!list_empty(&mapping->i_mmap)) + return 1; + if (!list_empty(&mapping->i_mmap_shared)) return 1; return 0; -- cgit v1.2.3