Unverified Commit 3a0ee774 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 7e7ec9c2 cdf360a7
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1623,7 +1623,7 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)
		 * has higher cost too. It would also probably require locking
		 * the anon_vma.
		 */
		if (vma->anon_vma)
		if (READ_ONCE(vma->anon_vma))
			continue;
		addr = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
		if (addr & ~HPAGE_PMD_MASK)
@@ -1642,6 +1642,18 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)
		 * reverse order. Trylock is a way to avoid deadlock.
		 */
		if (mmap_write_trylock(mm)) {
			/*
			 * Re-check whether we have an ->anon_vma, because
			 * collapse_and_free_pmd() requires that either no
			 * ->anon_vma exists or the anon_vma is locked.
			 * We already checked ->anon_vma above, but that check
			 * is racy because ->anon_vma can be populated under the
			 * mmap lock in read mode.
			 */
			if (vma->anon_vma) {
				mmap_write_unlock(mm);
				continue;
			}
			if (!khugepaged_test_exit(mm)) {
				struct mmu_notifier_range range;