diff options
author | Michal Hocko <[email protected]> | 2018-12-28 00:38:36 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-12-28 12:11:51 -0800 |
commit | e0975b2aae0e669f995f7d5f11db25c3080ae11c (patch) | |
tree | 85ef72a9df87997d6b35f298a0cb5230da7f1552 | |
parent | bb8965bd82fd4ed433a888f1383016ab3fa0d7de (diff) |
mm, fault_around: do not take a reference to a locked page
filemap_map_pages takes a speculative reference to each page in the range
before it tries to lock that page. While this is correct it also can
influence page migration which will bail out when seeing an elevated
reference count. The faultaround code would bail on seeing a locked page
so we can pro-actively check the PageLocked bit before
page_cache_get_speculative and prevent from pointless reference count
churn.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Michal Hocko <[email protected]>
Suggested-by: Jan Kara <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Acked-by: Hugh Dickins <[email protected]>
Reviewed-by: William Kucharski <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Pavel Tatashin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 8cec52968e83..29655fb47a2c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2614,6 +2614,13 @@ void filemap_map_pages(struct vm_fault *vmf, goto next; head = compound_head(page); + + /* + * Check for a locked page first, as a speculative + * reference may adversely influence page migration. + */ + if (PageLocked(head)) + goto next; if (!page_cache_get_speculative(head)) goto next; |