Skip to content

Commit f9bf6c0

Browse files
xzpeterakpm00
authored andcommitted
mm/hugetlb: use hugetlb_pte_stable in migration race check
After hugetlb_pte_stable() introduced, we can also rewrite the migration race condition against page allocation to use the new helper too. Link: https://lkml.kernel.org/r/20221004193400.110155-3-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com> Reviewed-by: David Hildenbrand <david@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Cc: Nadav Amit <nadav.amit@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 2ea7ff1 commit f9bf6c0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mm/hugetlb.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5634,11 +5634,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
56345634
* here. Before returning error, get ptl and make
56355635
* sure there really is no pte entry.
56365636
*/
5637-
ptl = huge_pte_lock(h, mm, ptep);
5638-
ret = 0;
5639-
if (huge_pte_none(huge_ptep_get(ptep)))
5637+
if (hugetlb_pte_stable(h, mm, ptep, old_pte))
56405638
ret = vmf_error(PTR_ERR(page));
5641-
spin_unlock(ptl);
5639+
else
5640+
ret = 0;
56425641
goto out;
56435642
}
56445643
clear_huge_page(page, address, pages_per_huge_page(h));

0 commit comments

Comments
 (0)