mmap: handle mlocked pages during map, remap, unmap

Originally by Nick Piggin <[email protected]>

Remove mlocked pages from the LRU using "unevictable infrastructure"
during mmap(), munmap(), mremap() and truncate().  Try to move back to
normal LRU lists on munmap() when last mlocked mapping removed.  Remove
PageMlocked() status when page truncated from file.

[[email protected]: cleanup]
[[email protected]: fix double unlock_page()]
[[email protected]: split LRU: munlock rework]
[[email protected]: mlock: fix __mlock_vma_pages_range comment block]
[[email protected]: remove bogus kerneldoc token]
Signed-off-by: Nick Piggin <[email protected]>
Signed-off-by: Lee Schermerhorn <[email protected]>
Signed-off-by: Rik van Riel <[email protected]>
Signed-off-by: KOSAKI Motohiro <[email protected]>
Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Rik van Riel 2008-10-18 20:26:50 -07:00 • committed by Linus Torvalds
commit ba470de431
6 changed files with 180 additions and 160 deletions

View file

@ -61,9 +61,14 @@ static inline unsigned long page_order(struct page *page)
return page_private(page);
}
extern int mlock_vma_pages_range(struct vm_area_struct *vma,
extern long mlock_vma_pages_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end);
extern void munlock_vma_pages_all(struct vm_area_struct *vma);
extern void munlock_vma_pages_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end);
static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
{
munlock_vma_pages_range(vma, vma->vm_start, vma->vm_end);
}
#ifdef CONFIG_UNEVICTABLE_LRU
/*