Commit 1bbb1949 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent e550cf78
...@@ -166,7 +166,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask) ...@@ -166,7 +166,7 @@ static int shrink_slab(long scanned, unsigned int gfp_mask)
} }
/* Must be called with page's pte_chain_lock held. */ /* 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; struct address_space *mapping = page->mapping;
...@@ -178,8 +178,14 @@ static inline int page_mapping_inuse(struct page * page) ...@@ -178,8 +178,14 @@ static inline int page_mapping_inuse(struct page * page)
if (!mapping) if (!mapping)
return 0; return 0;
/* Be more reluctant to reclaim swapcache than pagecache */
if (PageSwapCache(page))
return 1;
/* File is mmap'd by somebody. */ /* 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 1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment