aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 2da487d6cea8..49ed681ccc7b 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -684,6 +684,7 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
684pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address) 684pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address)
685{ 685{
686 pgd_t *pgd; 686 pgd_t *pgd;
687 p4d_t *p4d;
687 pud_t *pud; 688 pud_t *pud;
688 pmd_t *pmd = NULL; 689 pmd_t *pmd = NULL;
689 pmd_t pmde; 690 pmd_t pmde;
@@ -692,7 +693,11 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address)
692 if (!pgd_present(*pgd)) 693 if (!pgd_present(*pgd))
693 goto out; 694 goto out;
694 695
695 pud = pud_offset(pgd, address); 696 p4d = p4d_offset(pgd, address);
697 if (!p4d_present(*p4d))
698 goto out;
699
700 pud = pud_offset(p4d, address);
696 if (!pud_present(*pud)) 701 if (!pud_present(*pud))
697 goto out; 702 goto out;
698 703
@@ -1316,12 +1321,6 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
1316 } 1321 }
1317 1322
1318 while (page_vma_mapped_walk(&pvmw)) { 1323 while (page_vma_mapped_walk(&pvmw)) {
1319 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
1320 address = pvmw.address;
1321
1322 /* Unexpected PMD-mapped THP? */
1323 VM_BUG_ON_PAGE(!pvmw.pte, page);
1324
1325 /* 1324 /*
1326 * If the page is mlock()d, we cannot swap it out. 1325 * If the page is mlock()d, we cannot swap it out.
1327 * If it's recently referenced (perhaps page_referenced 1326 * If it's recently referenced (perhaps page_referenced
@@ -1345,6 +1344,13 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
1345 continue; 1344 continue;
1346 } 1345 }
1347 1346
1347 /* Unexpected PMD-mapped THP? */
1348 VM_BUG_ON_PAGE(!pvmw.pte, page);
1349
1350 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
1351 address = pvmw.address;
1352
1353
1348 if (!(flags & TTU_IGNORE_ACCESS)) { 1354 if (!(flags & TTU_IGNORE_ACCESS)) {
1349 if (ptep_clear_flush_young_notify(vma, address, 1355 if (ptep_clear_flush_young_notify(vma, address,
1350 pvmw.pte)) { 1356 pvmw.pte)) {