aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2013-06-20 05:00:14 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-21 02:01:53 -0400
commitf940f5289873af2ad2c4e73f88c24ad2b8fe3f87 (patch)
tree2e5e623bb15d5f1db3e191236a88221fb83fd693 /arch
parentdb3d8534903c8a9617142975bec6db95acaba753 (diff)
powerpc/THP: Double the PMD table size for THP
THP code does PTE page allocation along with large page request and deposit them for later use. This is to ensure that we won't have any failures when we split hugepages to regular pages. On powerpc we want to use the deposited PTE page for storing hash pte slot and secondary bit information for the HPTEs. We use the second half of the pmd table to save the deposted PTE page. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h6
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h3
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h6
-rw-r--r--arch/powerpc/mm/init_64.c9
4 files changed, 16 insertions, 8 deletions
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index b66ae722a8e9..f65e27b09bd3 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -221,17 +221,17 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
221 221
222static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 222static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
223{ 223{
224 return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), 224 return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
225 GFP_KERNEL|__GFP_REPEAT); 225 GFP_KERNEL|__GFP_REPEAT);
226} 226}
227 227
228static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 228static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
229{ 229{
230 kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd); 230 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
231} 231}
232 232
233#define __pmd_free_tlb(tlb, pmd, addr) \ 233#define __pmd_free_tlb(tlb, pmd, addr) \
234 pgtable_free_tlb(tlb, pmd, PMD_INDEX_SIZE) 234 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
235#ifndef CONFIG_PPC_64K_PAGES 235#ifndef CONFIG_PPC_64K_PAGES
236#define __pud_free_tlb(tlb, pud, addr) \ 236#define __pud_free_tlb(tlb, pud, addr) \
237 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) 237 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index 45142d640720..a56b82fb0609 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -33,7 +33,8 @@
33#define PGDIR_MASK (~(PGDIR_SIZE-1)) 33#define PGDIR_MASK (~(PGDIR_SIZE-1))
34 34
35/* Bits to mask out from a PMD to get to the PTE page */ 35/* Bits to mask out from a PMD to get to the PTE page */
36#define PMD_MASKED_BITS 0x1ff 36/* PMDs point to PTE table fragments which are 4K aligned. */
37#define PMD_MASKED_BITS 0xfff
37/* Bits to mask out from a PGD/PUD to get to the PMD page */ 38/* Bits to mask out from a PGD/PUD to get to the PMD page */
38#define PUD_MASKED_BITS 0x1ff 39#define PUD_MASKED_BITS 0x1ff
39 40
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index e3d55f6f24fe..ab843328b47f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -20,7 +20,11 @@
20 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) 20 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)
21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) 21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
22 22
23 23#ifdef CONFIG_TRANSPARENT_HUGEPAGE
24#define PMD_CACHE_INDEX (PMD_INDEX_SIZE + 1)
25#else
26#define PMD_CACHE_INDEX PMD_INDEX_SIZE
27#endif
24/* 28/*
25 * Define the address range of the kernel non-linear virtual area 29 * Define the address range of the kernel non-linear virtual area
26 */ 30 */
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index a90b9c458990..d0cd9e4c6837 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -88,7 +88,11 @@ static void pgd_ctor(void *addr)
88 88
89static void pmd_ctor(void *addr) 89static void pmd_ctor(void *addr)
90{ 90{
91#ifdef CONFIG_TRANSPARENT_HUGEPAGE
92 memset(addr, 0, PMD_TABLE_SIZE * 2);
93#else
91 memset(addr, 0, PMD_TABLE_SIZE); 94 memset(addr, 0, PMD_TABLE_SIZE);
95#endif
92} 96}
93 97
94struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE]; 98struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE];
@@ -137,10 +141,9 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
137void pgtable_cache_init(void) 141void pgtable_cache_init(void)
138{ 142{
139 pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); 143 pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
140 pgtable_cache_add(PMD_INDEX_SIZE, pmd_ctor); 144 pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor);
141 if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_INDEX_SIZE)) 145 if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_CACHE_INDEX))
142 panic("Couldn't allocate pgtable caches"); 146 panic("Couldn't allocate pgtable caches");
143
144 /* In all current configs, when the PUD index exists it's the 147 /* In all current configs, when the PUD index exists it's the
145 * same size as either the pgd or pmd index. Verify that the 148 * same size as either the pgd or pmd index. Verify that the
146 * initialization above has also created a PUD cache. This 149 * initialization above has also created a PUD cache. This