For transparent hugepage config, we need to use double the size of the pmd. Hence we should use PMD_CACHE_INDEX when allocating pagetable cache. For all configs other than book3s 64k this value is same as PMD_INDEX_SIZE. With 4k, since we don't support transparent hugepage in hash mode, we can use PMD_INDEX_SIZE even though CONFIG_TRANSPARENT_HUGEPAGE is defined. With book3s 4k THP is only supported in radix mode.
Fixes:"powerpc: port 64 bits pgtable_cache to 32 bits" Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com> --- arch/powerpc/include/asm/book3s/64/hash.h | 4 ++-- arch/powerpc/mm/init-common.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h index f61cad3de4e6..e95148c72916 100644 --- a/arch/powerpc/include/asm/book3s/64/hash.h +++ b/arch/powerpc/include/asm/book3s/64/hash.h @@ -33,9 +33,9 @@ H_PUD_INDEX_SIZE + H_PGD_INDEX_SIZE + PAGE_SHIFT) #define H_PGTABLE_RANGE (ASM_CONST(1) << H_PGTABLE_EADDR_SIZE) -#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !defined(CONFIG_PPC_4K_PAGES) /* - * only with hash we need to use the second half of pmd page table + * only with hash 64k we need to use the second half of pmd page table * to store pointer to deposited pgtable_t */ #define H_PMD_CACHE_INDEX (H_PMD_INDEX_SIZE + 1) diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index a175cd82ae8c..e733cf4d3401 100644 --- a/arch/powerpc/mm/init-common.c +++ b/arch/powerpc/mm/init-common.c @@ -88,7 +88,7 @@ void pgtable_cache_init(void) { pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); - if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) + if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX)) pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); /* * In all current configs, when the PUD index exists it's the @@ -100,7 +100,7 @@ void pgtable_cache_init(void) if (!PGT_CACHE(PGD_INDEX_SIZE)) panic("Couldn't allocate pgd cache"); - if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) + if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX)) panic("Couldn't allocate pmd pgtable caches"); if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) panic("Couldn't allocate pud pgtable caches"); -- 2.10.2