diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-06-20 05:00:26 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-06-21 02:01:58 -0400 |
commit | 437d496457a30ce9ccccb94b2373c201b2558392 (patch) | |
tree | 401857d741564eff170764518ed5acbeacc43f63 /arch/powerpc/mm | |
parent | d8e355a20f9dd45deea4c33db649dda59bdbd293 (diff) |
powerpc/THP: Enable THP on PPC64
We enable only if the we support 16MB page size.
Reviewed-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/pgtable_64.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index e4d3e9fb59be..074a4a225054 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
@@ -831,4 +831,33 @@ pmd_t pmdp_get_and_clear(struct mm_struct *mm, | |||
831 | memset(pgtable, 0, PTE_FRAG_SIZE); | 831 | memset(pgtable, 0, PTE_FRAG_SIZE); |
832 | return old_pmd; | 832 | return old_pmd; |
833 | } | 833 | } |
834 | |||
835 | int has_transparent_hugepage(void) | ||
836 | { | ||
837 | if (!mmu_has_feature(MMU_FTR_16M_PAGE)) | ||
838 | return 0; | ||
839 | /* | ||
840 | * We support THP only if PMD_SIZE is 16MB. | ||
841 | */ | ||
842 | if (mmu_psize_defs[MMU_PAGE_16M].shift != PMD_SHIFT) | ||
843 | return 0; | ||
844 | /* | ||
845 | * We need to make sure that we support 16MB hugepage in a segement | ||
846 | * with base page size 64K or 4K. We only enable THP with a PAGE_SIZE | ||
847 | * of 64K. | ||
848 | */ | ||
849 | /* | ||
850 | * If we have 64K HPTE, we will be using that by default | ||
851 | */ | ||
852 | if (mmu_psize_defs[MMU_PAGE_64K].shift && | ||
853 | (mmu_psize_defs[MMU_PAGE_64K].penc[MMU_PAGE_16M] == -1)) | ||
854 | return 0; | ||
855 | /* | ||
856 | * Ok we only have 4K HPTE | ||
857 | */ | ||
858 | if (mmu_psize_defs[MMU_PAGE_4K].penc[MMU_PAGE_16M] == -1) | ||
859 | return 0; | ||
860 | |||
861 | return 1; | ||
862 | } | ||
834 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 863 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |