mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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:
parent
8edb08caf6
commit
ba470de431
6 changed files with 180 additions and 160 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/task_io_accounting_ops.h>
|
||||
#include <linux/buffer_head.h> /* grr. try_to_release_page,
|
||||
do_invalidatepage */
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +104,7 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
|
|||
|
||||
cancel_dirty_page(page, PAGE_CACHE_SIZE);
|
||||
|
||||
clear_page_mlock(page);
|
||||
remove_from_page_cache(page);
|
||||
ClearPageMappedToDisk(page);
|
||||
page_cache_release(page); /* pagecache ref */
|
||||
|
|
@ -127,6 +129,7 @@ invalidate_complete_page(struct address_space *mapping, struct page *page)
|
|||
if (PagePrivate(page) && !try_to_release_page(page, 0))
|
||||
return 0;
|
||||
|
||||
clear_page_mlock(page);
|
||||
ret = remove_mapping(mapping, page);
|
||||
|
||||
return ret;
|
||||
|
|
@ -352,6 +355,7 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
|
|||
if (PageDirty(page))
|
||||
goto failed;
|
||||
|
||||
clear_page_mlock(page);
|
||||
BUG_ON(PagePrivate(page));
|
||||
__remove_from_page_cache(page);
|
||||
spin_unlock_irq(&mapping->tree_lock);
|
||||
|
|
|
|||
Loading…
Reference in a new issue