[RFC PATCH 5/6] powerpc/mm: Use page fragments for allocation page table at PMD level
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Thu Feb 15 00:50:08 AEDT 2018
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
---
arch/powerpc/include/asm/book3s/64/pgalloc.h | 9 ++-------
arch/powerpc/mm/init-common.c | 2 --
arch/powerpc/mm/pgtable_64.c | 2 +-
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/pgalloc.h b/arch/powerpc/include/asm/book3s/64/pgalloc.h
index e5d104caae26..f91a8bc1d67f 100644
--- a/arch/powerpc/include/asm/book3s/64/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h
@@ -128,17 +128,12 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
{
- pmd_t *pmd;
- pmd = kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
- pgtable_gfp_flags(mm, GFP_KERNEL));
- memset(pmd, 0, PMD_TABLE_SIZE);
- return pmd;
-
+ return pmd_fragment_alloc(mm, addr);
}
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
{
- kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
+ pmd_fragment_free((unsigned long *)pmd);
}
static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index f92dd8cee3c5..0382df3ef6a8 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -78,8 +78,6 @@ void pgtable_cache_init(void)
{
pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
- if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX))
- pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor);
/*
* In all current configs, when the PUD index exists it's the
* same size as either the pgd or pmd index except with THP enabled
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index db3ee7ab8418..05267a8764f5 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -524,7 +524,7 @@ void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int index)
pte_fragment_free(table, 0);
break;
case PMD_INDEX:
- kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), table);
+ pmd_fragment_free(table);
break;
case PUD_INDEX:
kmem_cache_free(PGT_CACHE(PUD_CACHE_INDEX), table);
--
2.14.3
More information about the Linuxppc-dev
mailing list