]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
powerpc/mm/hugetlb: initialize the pagetable cache correctly for hugetlb
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Fri, 30 Mar 2018 12:04:08 +0000 (17:34 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 4 Apr 2018 06:58:53 +0000 (16:58 +1000)
With 64k page size, we have hugetlb pte entries at the pmd and pud level for
book3s64. We don't need to create a separate page table cache for that. With 4k
we need to make sure hugepd page table cache for 16M is placed at PUD level
and 16G at the PGD level.

Simplify all these by not using HUGEPD_PD_SHIFT which is confusing for book3s64.

Without this patch, with 64k page size we create pagetable caches with shift
value 10 and 7 which are not used at all.

Fixes: 419df06eea5b ("powerpc: Reduce the PTE_INDEX_SIZE")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/hugetlbpage.c

index f4153f21d2144eee7f50b7ee36e169997911fdd5..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
 
 /*
@@ -670,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.