]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/powerpc/mm/hugetlbpage.c
powerpc/mm/hugetlb: initialize the pagetable cache correctly for hugetlb
[linux.git] / arch / powerpc / mm / hugetlbpage.c
index 876da2bc1796ba1b8568ad9a26450dcd4c162ecd..99cf860969701779c8a9d06017a9b8cf88c66cf6 100644 (file)
@@ -122,9 +122,6 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
 #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)
 #define HUGEPD_PGD_SHIFT PGDIR_SHIFT
 #define HUGEPD_PUD_SHIFT PUD_SHIFT
-#else
-#define HUGEPD_PGD_SHIFT PUD_SHIFT
-#define HUGEPD_PUD_SHIFT PMD_SHIFT
 #endif
 
 /*
@@ -553,9 +550,11 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
        struct hstate *hstate = hstate_file(file);
        int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
 
+#ifdef CONFIG_PPC_RADIX_MMU
        if (radix_enabled())
                return radix__hugetlb_get_unmapped_area(file, addr, len,
                                                       pgoff, flags);
+#endif
        return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1);
 }
 #endif
@@ -563,10 +562,12 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
 {
 #ifdef CONFIG_PPC_MM_SLICES
-       unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
        /* With radix we don't use slice, so derive it from vma*/
-       if (!radix_enabled())
+       if (!radix_enabled()) {
+               unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
+
                return 1UL << mmu_psize_to_shift(psize);
+       }
 #endif
        if (!is_vm_hugetlb_page(vma))
                return PAGE_SIZE;
@@ -666,15 +667,26 @@ static int __init hugetlbpage_init(void)
 
                shift = mmu_psize_to_shift(psize);
 
-               if (add_huge_page_size(1ULL << shift) < 0)
+#ifdef CONFIG_PPC_BOOK3S_64
+               if (shift > PGDIR_SHIFT)
                        continue;
-
+               else if (shift > PUD_SHIFT)
+                       pdshift = PGDIR_SHIFT;
+               else if (shift > PMD_SHIFT)
+                       pdshift = PUD_SHIFT;
+               else
+                       pdshift = PMD_SHIFT;
+#else
                if (shift < HUGEPD_PUD_SHIFT)
                        pdshift = PMD_SHIFT;
                else if (shift < HUGEPD_PGD_SHIFT)
                        pdshift = PUD_SHIFT;
                else
                        pdshift = PGDIR_SHIFT;
+#endif
+
+               if (add_huge_page_size(1ULL << shift) < 0)
+                       continue;
                /*
                 * if we have pdshift and shift value same, we don't
                 * use pgt cache for hugepd.