OSDN Git Service

dt-bindings: display: mediatek: Fix examples on new bindings
[uclinux-h8/linux.git] / mm / hugetlb.c
index f425147..b34f501 100644 (file)
@@ -1321,7 +1321,9 @@ static void __destroy_compound_gigantic_page(struct page *page,
        }
 
        set_compound_order(page, 0);
+#ifdef CONFIG_64BIT
        page[1].compound_nr = 0;
+#endif
        __ClearPageHead(page);
 }
 
@@ -1813,7 +1815,9 @@ out_error:
        for (; j < nr_pages; j++, p = mem_map_next(p, page, j))
                __ClearPageReserved(p);
        set_compound_order(page, 0);
+#ifdef CONFIG_64BIT
        page[1].compound_nr = 0;
+#endif
        __ClearPageHead(page);
        return false;
 }
@@ -5013,7 +5017,7 @@ static void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct
                        set_page_dirty(page);
 
                hugetlb_count_sub(pages_per_huge_page(h), mm);
-               page_remove_rmap(page, true);
+               page_remove_rmap(page, vma, true);
 
                spin_unlock(ptl);
                tlb_remove_page_size(tlb, page, huge_page_size(h));
@@ -5258,7 +5262,7 @@ retry_avoidcopy:
                /* Break COW */
                huge_ptep_clear_flush(vma, haddr, ptep);
                mmu_notifier_invalidate_range(mm, range.start, range.end);
-               page_remove_rmap(old_page, true);
+               page_remove_rmap(old_page, vma, true);
                hugepage_add_new_anon_rmap(new_page, vma, haddr);
                set_huge_pte_at(mm, haddr, ptep,
                                make_huge_pte(vma, new_page, 1));
@@ -5341,6 +5345,7 @@ static inline vm_fault_t hugetlb_handle_userfault(struct vm_area_struct *vma,
                                                  pgoff_t idx,
                                                  unsigned int flags,
                                                  unsigned long haddr,
+                                                 unsigned long addr,
                                                  unsigned long reason)
 {
        vm_fault_t ret;
@@ -5348,6 +5353,7 @@ static inline vm_fault_t hugetlb_handle_userfault(struct vm_area_struct *vma,
        struct vm_fault vmf = {
                .vma = vma,
                .address = haddr,
+               .real_address = addr,
                .flags = flags,
 
                /*
@@ -5416,7 +5422,7 @@ retry:
                /* Check for page in userfault range */
                if (userfaultfd_missing(vma)) {
                        ret = hugetlb_handle_userfault(vma, mapping, idx,
-                                                      flags, haddr,
+                                                      flags, haddr, address,
                                                       VM_UFFD_MISSING);
                        goto out;
                }
@@ -5480,7 +5486,7 @@ retry:
                        unlock_page(page);
                        put_page(page);
                        ret = hugetlb_handle_userfault(vma, mapping, idx,
-                                                      flags, haddr,
+                                                      flags, haddr, address,
                                                       VM_UFFD_MINOR);
                        goto out;
                }
@@ -6072,7 +6078,7 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
 
                if (pages) {
                        /*
-                        * try_grab_compound_head() should always succeed here,
+                        * try_grab_folio() should always succeed here,
                         * because: a) we hold the ptl lock, and b) we've just
                         * checked that the huge page is present in the page
                         * tables. If the huge page is present, then the tail
@@ -6081,9 +6087,8 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
                         * any way. So this page must be available at this
                         * point, unless the page refcount overflowed:
                         */
-                       if (WARN_ON_ONCE(!try_grab_compound_head(pages[i],
-                                                                refs,
-                                                                flags))) {
+                       if (WARN_ON_ONCE(!try_grab_folio(pages[i], refs,
+                                                        flags))) {
                                spin_unlock(ptl);
                                remainder = 0;
                                err = -ENOMEM;