mm/hugetlb: don't wait for migration entry during follow page
authorPeter Xu <peterx@redhat.com>
Fri, 16 Dec 2022 15:50:53 +0000 (10:50 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 19 Jan 2023 01:12:38 +0000 (17:12 -0800)
That's what the code does with !hugetlb pages, so we should logically do
the same for hugetlb, so migration entry will also be treated as no page.

This is probably also the last piece in follow_page code that may sleep,
the last one should be removed in cf994dd8af27 ("mm/gup: remove
FOLL_MIGRATION", 2022-11-16).

Link: https://lkml.kernel.org/r/20221216155100.2043537-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>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: James Houghton <jthoughton@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Rik van Riel <riel@surriel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index ed1ac2df582cfe2e77cc63eb9c529965fbf9b0ec..549f796687567f05bd2d69136442512650e7ae9a 100644 (file)
@@ -6401,7 +6401,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma,
        if (WARN_ON_ONCE(flags & FOLL_PIN))
                return NULL;
 
-retry:
        pte = huge_pte_offset(mm, haddr, huge_page_size(h));
        if (!pte)
                return NULL;
@@ -6424,16 +6423,6 @@ retry:
                        page = NULL;
                        goto out;
                }
-       } else {
-               if (is_hugetlb_entry_migration(entry)) {
-                       spin_unlock(ptl);
-                       __migration_entry_wait_huge(pte, ptl);
-                       goto retry;
-               }
-               /*
-                * hwpoisoned entry is treated as no_page_table in
-                * follow_page_mask().
-                */
        }
 out:
        spin_unlock(ptl);