mm/hugetlb: Cleanup ARCH_HAS_GIGANTIC_PAGE
Subsystems (6)
PATCH v2 1/2 mm/hugetlb: Cleanup ARCH_HAS_GIGANTIC_PAGE
This moves the #ifdef in C code to a Kconfig dependency. Also we move the gigantic_page_supported() function to be arch specific. This gives arch to conditionally enable runtime allocation of gigantic huge page. Architectures like ppc64 supports different gigantic huge page size (16G and 1G) based on the translation mode selected. This provides an opportunity for ppc64 to enable runtime allocation only w.r.t 1G hugepage.
No functional change in this patch.
--- arch/arm64/Kconfig | 2 +- arch/arm64/include/asm/hugetlb.h | 4 ++++ arch/s390/Kconfig | 2 +- arch/s390/include/asm/hugetlb.h | 3 +++ arch/x86/Kconfig | 2 +- mm/hugetlb.c | 7 ++----- 6 files changed, 12 insertions(+), 8 deletions(-)
arch/arm64/Kconfig +1 -1
@@ -11,7 +11,7 @@ config ARM64 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAIN
arch/arm64/include/asm/hugetlb.h +4 -0
@@ -83,4 +83,8 @@ extern void huge_ptep_set_wrprotect(struct mm_struct *mm,extern void huge_ptep_clear_flush (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep); +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif +#endif /* __ASM_HUGETLB_H */
arch/s390/Kconfig +1 -1
@@ -67,7 +67,7 @@ config S390 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAIN
arch/s390/include/asm/hugetlb.h +3 -0
@@ -112,4 +112,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif #endif /* _ASM_S390_HUGETLB_H */
arch/x86/Kconfig +1 -1
@@ -22,7 +22,7 @@ config X86_64 def_bool y depends on 64BIT # Options that are inherently 64-bit kernel only: - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_SUPPORTS_INT128 select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_SOFT_DIRTY
mm/hugetlb.c +2 -5
@@ -1024,9 +1024,7 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed) ((node =hstate_next_node_to_free (hs, mask)) ||1 ); \ nr_nodes--) -#if defined(CONFIG_ARCH_HAS_GIGANTIC_PAGE ) && \ - ((defined(CONFIG_MEMORY_ISOLATION ) && defined(CONFIG_COMPACTION )) || \ - defined(CONFIG_CMA )) +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE static void destroy_compound_gigantic_page (struct page *page,unsigned int order) {
@@ -1158,8 +1156,7 @@ static int alloc_fresh_gigantic_page(struct hstate *h,return 0 ; } -static inline bool gigantic_page_supported (void ) {return true; } -#else +#else /* !CONFIG_ARCH_HAS_GIGANTIC_PAGE */ static inline bool gigantic_page_supported (void ) {return false; }static inline void free_gigantic_page (struct page *page,unsigned int order) { } static inline void destroy_compound_gigantic_page(struct page *page,
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 2/2 powerpc/mm/hugetlb: Add support for 1G huge pages
POWER9 supports hugepages of size 2M and 1G in radix MMU mode. This patch enables the usage of 1G page size for hugetlbfs. This also update the helper such we can do 1G page allocation at runtime.
We still don't enable 1G page size on DD1 version. This is to avoid doing workaround mentioned in commit: 6d3a0379ebdc8 (powerpc/mm: Add radix__tlb_flush_pte_p9_dd1()
--- arch/powerpc/include/asm/book3s/64/hugetlb.h | 10 ++++++++++ arch/powerpc/mm/hugetlbpage.c | 7 +++++-- arch/powerpc/platforms/Kconfig.cputype | 1 + 3 files changed, 16 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/hugetlb.h +10 -0
@@ -50,4 +50,14 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, else return entry; } + +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) +{ +if (radix_enabled ()) +return true; +return false; +} +#endif +#endif
arch/powerpc/mm/hugetlbpage.c +5 -2
@@ -763,8 +763,11 @@ static int __init add_huge_page_size(unsigned long long size)* Hash: 16M and 16G */ if (radix_enabled ()) { -if (mmu_psize !=MMU_PAGE_2M ) -return -EINVAL ; +if (mmu_psize !=MMU_PAGE_2M ) { +if (cpu_has_feature (CPU_FTR_POWER9_DD1 ) || + (mmu_psize !=MMU_PAGE_1G )) +return -EINVAL ; + } }else {if (mmu_psize !=MMU_PAGE_16M && mmu_psize !=MMU_PAGE_16G )return -EINVAL ;
arch/powerpc/platforms/Kconfig.cputype +1 -0
@@ -344,6 +344,7 @@ config PPC_STD_MMU_64 config PPC_RADIX_MMU bool "Radix MMU Support" depends on PPC_BOOK3S_64 + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA default y help Enable support for the Power ISA 3.0 Radix style MMU. Currently this
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v2 2/2] powerpc/mm/hugetlb: Add support for 1G huge pages
Quoted 9 lines · Aneesh Kumar K.V
POWER9 supports hugepages of size 2M and 1G in radix MMU mode. This patch enables the usage of 1G page size for hugetlbfs. This also update the helper such we can do 1G page allocation at runtime.
We still don't enable 1G page size on DD1 version. This is to avoid doing workaround mentioned in commit:
6d3a0379ebdc8(powerpc/mm: Addradix__tlb_flush_pte_p9_dd1()Signed-off-by Aneesh Kumar K.V <[email protected]>
Sounds good.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Aneesh Kumar K.V
This moves the #ifdef in C code to a
Kconfigdependency. Also we move thegigantic_page_supported()function to be arch specific. This gives arch to conditionally enable runtime allocation of gigantic huge page. Architectures like ppc64 supports different gigantic huge page size (16G and 1G) based on the translation mode selected. This provides an opportunity for ppc64 to enable runtime allocation only w.r.t 1G hugepage.
Right.
Quoted 69 lines
No functional change in this patch.
Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/arm64/Kconfig | 2 +- arch/arm64/include/asm/hugetlb.h | 4 ++++ arch/s390/Kconfig | 2 +- arch/s390/include/asm/hugetlb.h | 3 +++ arch/x86/Kconfig | 2 +- mm/hugetlb.c | 7 ++----- 6 files changed, 12 insertions(+), 8 deletions(-)arch/arm64/Kconfig +1
-1@@ -11,7 +11,7 @@ config ARM64 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAINarch/arm64/include/asm/hugetlb.h +4
-0@@ -83,4 +83,8 @@ extern void huge_ptep_set_wrprotect(struct mm_struct *mm,extern void huge_ptep_clear_flush (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep); +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif +#endif /* __ASM_HUGETLB_H */ arch/s390/Kconfig +1
-1@@ -67,7 +67,7 @@ config S390 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAINarch/s390/include/asm/hugetlb.h +3
-0@@ -112,4 +112,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif #endif /* _ASM_S390_HUGETLB_H */ arch/x86/Kconfig +0
-0
arch/x86/Kconfig config X86_64 · line 28
Quoted 8 lines
arch/x86/Kconfig +1
-1@@ -22,7 +22,7 @@ config X86_64 def_bool y depends on 64BIT # Options that are inherently 64-bit kernel only: - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_SUPPORTS_INT128 select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_SOFT_DIRTY
Should not we define gigantic_page_supported() function for X86 as well like the other two archs above ?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 82 lines · Anshuman Khandual
Quoted 6 lines · Aneesh Kumar K.V
This moves the #ifdef in C code to a
Kconfigdependency. Also we move thegigantic_page_supported()function to be arch specific. This gives arch to conditionally enable runtime allocation of gigantic huge page. Architectures like ppc64 supports different gigantic huge page size (16G and 1G) based on the translation mode selected. This provides an opportunity for ppc64 to enable runtime allocation only w.r.t 1G hugepage.Right.
Quoted 72 lines
No functional change in this patch.
Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/arm64/Kconfig | 2 +- arch/arm64/include/asm/hugetlb.h | 4 ++++ arch/s390/Kconfig | 2 +- arch/s390/include/asm/hugetlb.h | 3 +++ arch/x86/Kconfig | 2 +- mm/hugetlb.c | 7 ++----- 6 files changed, 12 insertions(+), 8 deletions(-)arch/arm64/Kconfig +1
-1@@ -11,7 +11,7 @@ config ARM64 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAINarch/arm64/include/asm/hugetlb.h +4
-0@@ -83,4 +83,8 @@ extern void huge_ptep_set_wrprotect(struct mm_struct *mm,extern void huge_ptep_clear_flush (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep); +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif +#endif /* __ASM_HUGETLB_H */ arch/s390/Kconfig +1
-1@@ -67,7 +67,7 @@ config S390 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_HAS_KCOV select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAINarch/s390/include/asm/hugetlb.h +3
-0@@ -112,4 +112,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE +static inline bool gigantic_page_supported (void ) {return true; } +#endif #endif /* _ASM_S390_HUGETLB_H */ arch/x86/Kconfig +0
-0@@ -22,7 +22,7 @@ config X86_64 def_bool y depends on 64BIT # Options that are inherently 64-bit kernel only:
Quoted 9 lines
arch/x86/Kconfig config X86_64 · line 28
Quoted 5 lines
arch/x86/Kconfig +1
-1- select ARCH_HAS_GIGANTIC_PAGE + select ARCH_HAS_GIGANTIC_PAGE if MEMORY_ISOLATION && COMPACTION && CMA select ARCH_SUPPORTS_INT128 select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_SOFT_DIRTYShould not we define
gigantic_page_supported()function for X86 as well like the other two archs above ?
yes. Will update the patch.
-aneesh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>