From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp08.in.ibm.com (e28smtp08.in.ibm.com [122.248.162.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp08.in.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C27A72C02C7 for ; Fri, 22 Feb 2013 03:48:07 +1100 (EST) Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Feb 2013 22:14:38 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 77B003940057 for ; Thu, 21 Feb 2013 22:18:03 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1LGlxN935979508 for ; Thu, 21 Feb 2013 22:17:59 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1LGm0Zi011583 for ; Fri, 22 Feb 2013 03:48:02 +1100 From: "Aneesh Kumar K.V" To: benh@kernel.crashing.org, paulus@samba.org Subject: [RFC PATCH -V2 21/21] powerpc/THP: Enable THP on PPC64 Date: Thu, 21 Feb 2013 22:17:28 +0530 Message-Id: <1361465248-10867-22-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1361465248-10867-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1361465248-10867-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Aneesh Kumar K.V" We enable only if the we support 16MB page size. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pgtable.h | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 5b8e93b..ae9114b 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -107,8 +107,37 @@ static inline int pmd_trans_huge(pmd_t pmd) return ((pmd_val(pmd) & PMD_ISHUGE) == PMD_ISHUGE); } -/* We will enable it in the last patch */ -#define has_transparent_hugepage() 0 +static inline int has_transparent_hugepage(void) +{ + if (!mmu_has_feature(MMU_FTR_16M_PAGE)) + return 0; + /* + * We support THP only if HPAGE_SHIFT is 16MB. + */ + if (!HPAGE_SHIFT || (HPAGE_SHIFT != mmu_psize_defs[MMU_PAGE_16M].shift)) + return 0; + /* + * We need to make sure that we support 16MB huge page in a segement + * with base page size 64K or 4K. We only enable THP with a PAGE_SIZE + * of 64K. + */ + /* FIXME!! is the nonzero check always correct ? Can there be an machine + * where penc is 0 ? + */ + /* + * If we have 64K HPTE, we will be using that by default + */ + if (mmu_psize_defs[MMU_PAGE_64K].shift && + !mmu_psize_defs[MMU_PAGE_64K].penc[MMU_PAGE_16M]) + return 0; + /* + * Ok we only have 4K HPTE + */ + if (!mmu_psize_defs[MMU_PAGE_4K].penc[MMU_PAGE_16M]) + return 0; + + return 1; +} static inline pmd_t pmd_mkold(pmd_t pmd) { -- 1.7.10