summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-10-31 04:09:31 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-31 04:09:31 -0800
commit1bbb1949d7e25c69ecda368cc0b8b2e4e893e5ce (patch)
treef67d1040db056fd50221b1c7ddba134dfaeac16d
parente550cf78d77a3ca7311d132888b6caf5dd6f8b40 (diff)
[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.
-rw-r--r--mm/vmscan.c10
1 files 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;