diff options
author | Hugh Dickins <hugh@veritas.com> | 2008-02-04 22:29:23 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 09:44:18 -0800 |
commit | 5a9bbdcd29adbb786c53eba1dfc3c2d256020d6b (patch) | |
tree | 44fbcff2ad653d7a328bab3144d63da9aaea6f7a | |
parent | 9eccf2a816ed0aad82b577de6a40cd098ad41944 (diff) | |
download | linux-5a9bbdcd29adbb786c53eba1dfc3c2d256020d6b.tar.gz linux-5a9bbdcd29adbb786c53eba1dfc3c2d256020d6b.tar.bz2 linux-5a9bbdcd29adbb786c53eba1dfc3c2d256020d6b.zip |
mm: don't waste swap on locked pages
try_to_unmap always fails on a page found in a VM_LOCKED vma (unless
migrating), and recycles it back to the active list. But if it's an
anonymous page, we've already allocated swap to it: just wasting swap.
Spot locked pages in page_referenced_one and treat them as referenced.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Tested-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Ethan Solomita <solo@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/rmap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/rmap.c b/mm/rmap.c index 0334c8f6b741..57ad276900c9 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -283,7 +283,10 @@ static int page_referenced_one(struct page *page, if (!pte) goto out; - if (ptep_clear_flush_young(vma, address, pte)) + if (vma->vm_flags & VM_LOCKED) { + referenced++; + *mapcount = 1; /* break early from loop */ + } else if (ptep_clear_flush_young(vma, address, pte)) referenced++; /* Pretend the page is referenced if the task has the |