Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1354073
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC 5/9] powerpc/mm: Split huge_pte_offset function for BOOK3S 64K |
| Date | 2016-03-09 13:20 +0100 |
| Message-ID | <raLfR-7Ms-49@gated-at.bofh.it> (permalink) |
| References | <raLfP-7Ms-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Currently the 'huge_pte_offset' function has only one version for
all the configuations and platforms. This change splits the function
into two versions, one for 64K page size based BOOK3S implementation
and the other one for everything else. This change is also one of the
prerequisites towards enabling GENERAL_HUGETLB implementation for
BOOK3S 64K based huge pages.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
arch/powerpc/mm/hugetlbpage.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index a49c6ae..f834a74 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -53,11 +53,46 @@ static unsigned nr_gpages;
#define hugepd_none(hpd) ((hpd).pd == 0)
+#if !defined(CONFIG_PPC_64K_PAGES) || !defined(CONFIG_PPC_BOOK3S_64)
pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
{
/* Only called for hugetlbfs pages, hence can ignore THP */
return __find_linux_pte_or_hugepte(mm->pgd, addr, NULL, NULL);
}
+#else
+pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
+{
+ pgd_t pgd, *pgdp;
+ pud_t pud, *pudp;
+ pmd_t pmd, *pmdp;
+
+ pgdp = mm->pgd + pgd_index(addr);
+ pgd = READ_ONCE(*pgdp);
+
+ if (pgd_none(pgd))
+ return NULL;
+
+ if (pgd_huge(pgd))
+ return (pte_t *)pgdp;
+
+ pudp = pud_offset(&pgd, addr);
+ pud = READ_ONCE(*pudp);
+ if (pud_none(pud))
+ return NULL;
+
+ if (pud_huge(pud))
+ return (pte_t *)pudp;
+
+ pmdp = pmd_offset(&pud, addr);
+ pmd = READ_ONCE(*pmdp);
+ if (pmd_none(pmd))
+ return NULL;
+
+ if (pmd_huge(pmd))
+ return (pte_t *)pmdp;
+ return NULL;
+}
+#endif /* !defined(CONFIG_PPC_64K_PAGES) || !defined(CONFIG_PPC_BOOK3S_64) */
#if !defined(CONFIG_PPC_64K_PAGES) || !defined(CONFIG_PPC_BOOK3S_64)
static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
--
2.1.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-09 13:20 +0100
[RFC 4/9] powerpc/mm: Split huge_pte_alloc function for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-09 13:20 +0100
Re: [RFC 4/9] powerpc/mm: Split huge_pte_alloc function for BOOK3S 64K "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2016-03-09 21:00 +0100
Re: [RFC 4/9] powerpc/mm: Split huge_pte_alloc function for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-10 06:40 +0100
[RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-09 13:20 +0100
Re: [RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB for BOOK3S 64K "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2016-03-09 21:00 +0100
Re: [RFC 6/9] powerpc/hugetlb: Enable ARCH_WANT_GENERAL_HUGETLB for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-10 06:20 +0100
[RFC 5/9] powerpc/mm: Split huge_pte_offset function for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-09 13:20 +0100
Re: [RFC 5/9] powerpc/mm: Split huge_pte_offset function for BOOK3S 64K Dave Hansen <dave.hansen@intel.com> - 2016-03-10 00:00 +0100
Re: [RFC 5/9] powerpc/mm: Split huge_pte_offset function for BOOK3S 64K Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-10 04:40 +0100
Re: [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-03-11 04:10 +0100
Re: [RFC 1/9] mm/hugetlb: Make GENERAL_HUGETLB functions PGD implementation aware Andrew Morton <akpm@linux-foundation.org> - 2016-03-14 21:30 +0100
csiph-web