diff options
author | Peter Xu <peterx@redhat.com> | 2022-10-04 15:33:59 -0400 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-10-12 18:51:50 -0700 |
commit | f9bf6c03eca1077cae8de0e6d86427656fa42a9b (patch) | |
tree | 8eaee54738861e0034dcf42b17072966492ddf02 /mm | |
parent | 2ea7ff1e39cbe3753d3c649beb70f2cf861dca75 (diff) |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bf9d8d04bf4f..9b26055f3119 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5634,11 +5634,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * here. Before returning error, get ptl and make * sure there really is no pte entry. */ - ptl = huge_pte_lock(h, mm, ptep); - ret = 0; - if (huge_pte_none(huge_ptep_get(ptep))) + if (hugetlb_pte_stable(h, mm, ptep, old_pte)) ret = vmf_error(PTR_ERR(page)); - spin_unlock(ptl); + else + ret = 0; goto out; } clear_huge_page(page, address, pages_per_huge_page(h)); |