From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbdEPP3k (ORCPT ); Tue, 16 May 2017 11:29:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49963 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbdEPP3j (ORCPT ); Tue, 16 May 2017 11:29:39 -0400 Subject: Re: [PATCH v2 1/2] mm/hugetlb: Cleanup ARCH_HAS_GIGANTIC_PAGE To: Anshuman Khandual , akpm@linux-foundation.org, mpe@ellerman.id.au References: <1494926264-22463-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <87c68117-3163-b092-ec51-1d618fc42b85@linux.vnet.ibm.com> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org From: "Aneesh Kumar K.V" Date: Tue, 16 May 2017 20:59:12 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <87c68117-3163-b092-ec51-1d618fc42b85@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17051615-0024-0000-0000-0000027044B1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007072; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00861314; UDB=6.00427185; IPR=6.00640977; BA=6.00005351; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015482; XFM=3.00000015; UTC=2017-05-16 15:29:33 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051615-0025-0000-0000-00004404B710 Message-Id: <87aedd86-08ea-6ece-4192-36c9659939d4@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-16_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705160123 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 16 May 2017 03:52 PM, Anshuman Khandual wrote: > On 05/16/2017 02:47 PM, Aneesh Kumar K.V wrote: >> 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. > > Right. > >> >> No functional change in this patch. >> >> Signed-off-by: Aneesh Kumar K.V >> --- >> 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(-) >> >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >> index 3741859765cf..1f8c1f73aada 100644 >> --- a/arch/arm64/Kconfig >> +++ b/arch/arm64/Kconfig >> @@ -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 >> diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h >> index bbc1e35aa601..793bd73b0d07 100644 >> --- a/arch/arm64/include/asm/hugetlb.h >> +++ b/arch/arm64/include/asm/hugetlb.h >> @@ -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 */ >> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig >> index a2dcef0aacc7..a41bbf420dda 100644 >> --- a/arch/s390/Kconfig >> +++ b/arch/s390/Kconfig >> @@ -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 >> diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h >> index cd546a245c68..89057b2cc8fe 100644 >> --- a/arch/s390/include/asm/hugetlb.h >> +++ b/arch/s390/include/asm/hugetlb.h >> @@ -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 */ >> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >> index cc98d5a294ee..30a6328136ac 100644 >> --- a/arch/x86/Kconfig >> +++ b/arch/x86/Kconfig >> @@ -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 ? > yes. Will update the patch. -aneesh