diff options
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r-- | mm/huge_memory.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 08a943b9cf95..3a8d6b7d95db 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -971,11 +971,12 @@ out_unlock: | |||
971 | return ret; | 971 | return ret; |
972 | } | 972 | } |
973 | 973 | ||
974 | struct page *follow_trans_huge_pmd(struct mm_struct *mm, | 974 | struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, |
975 | unsigned long addr, | 975 | unsigned long addr, |
976 | pmd_t *pmd, | 976 | pmd_t *pmd, |
977 | unsigned int flags) | 977 | unsigned int flags) |
978 | { | 978 | { |
979 | struct mm_struct *mm = vma->vm_mm; | ||
979 | struct page *page = NULL; | 980 | struct page *page = NULL; |
980 | 981 | ||
981 | assert_spin_locked(&mm->page_table_lock); | 982 | assert_spin_locked(&mm->page_table_lock); |
@@ -998,6 +999,14 @@ struct page *follow_trans_huge_pmd(struct mm_struct *mm, | |||
998 | _pmd = pmd_mkyoung(pmd_mkdirty(*pmd)); | 999 | _pmd = pmd_mkyoung(pmd_mkdirty(*pmd)); |
999 | set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd); | 1000 | set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd); |
1000 | } | 1001 | } |
1002 | if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { | ||
1003 | if (page->mapping && trylock_page(page)) { | ||
1004 | lru_add_drain(); | ||
1005 | if (page->mapping) | ||
1006 | mlock_vma_page(page); | ||
1007 | unlock_page(page); | ||
1008 | } | ||
1009 | } | ||
1001 | page += (addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT; | 1010 | page += (addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT; |
1002 | VM_BUG_ON(!PageCompound(page)); | 1011 | VM_BUG_ON(!PageCompound(page)); |
1003 | if (flags & FOLL_GET) | 1012 | if (flags & FOLL_GET) |