Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f52e67e authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Linus Torvalds
Browse files

khugepaged: recheck pmd after mmap_sem re-acquired

parent 8024ee2a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2433,6 +2433,9 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,
			/* vma is no longer available, don't continue to swapin */
			if (hugepage_vma_revalidate(mm, address))
				return false;
			/* check if the pmd is still valid */
			if (mm_find_pmd(mm, address) != pmd)
				return false;
		}
		if (ret & VM_FAULT_ERROR) {
			trace_mm_collapse_huge_page_swapin(mm, swapped_in, 0);
@@ -2518,6 +2521,9 @@ static void collapse_huge_page(struct mm_struct *mm,
	result = hugepage_vma_revalidate(mm, address);
	if (result)
		goto out;
	/* check if the pmd is still valid */
	if (mm_find_pmd(mm, address) != pmd)
		goto out;

	anon_vma_lock_write(vma->anon_vma);