Merge branches 'slab/cleanups', 'slab/failslab', 'slab/fixes' and 'slub/percpu' into...
[linux-3.10.git] / mm / pagewalk.c
index a286915..7b47a57 100644 (file)
@@ -120,15 +120,31 @@ int walk_page_range(unsigned long addr, unsigned long end,
        do {
                next = pgd_addr_end(addr, end);
 
-               /* skip hugetlb vma to avoid hugepage PMD being cleared
-                * in pmd_none_or_clear_bad(). */
+               /*
+                * handle hugetlb vma individually because pagetable walk for
+                * the hugetlb page is dependent on the architecture and
+                * we can't handled it in the same manner as non-huge pages.
+                */
                vma = find_vma(walk->mm, addr);
+#ifdef CONFIG_HUGETLB_PAGE
                if (vma && is_vm_hugetlb_page(vma)) {
+                       pte_t *pte;
+                       struct hstate *hs;
+
                        if (vma->vm_end < next)
                                next = vma->vm_end;
+                       hs = hstate_vma(vma);
+                       pte = huge_pte_offset(walk->mm,
+                                             addr & huge_page_mask(hs));
+                       if (pte && !huge_pte_none(huge_ptep_get(pte))
+                           && walk->hugetlb_entry)
+                               err = walk->hugetlb_entry(pte, addr,
+                                                         next, walk);
+                       if (err)
+                               break;
                        continue;
                }
-
+#endif
                if (pgd_none_or_clear_bad(pgd)) {
                        if (walk->pte_hole)
                                err = walk->pte_hole(addr, next, walk);