aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/init_64.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-09 22:53:16 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-09 23:03:29 -0500
commit87655ff26817993932b7d049c4df226fb2c0ac5f (patch)
tree800631fd3ac350595e5be00bd464bf91cd8e9c32 /arch/powerpc/mm/init_64.c
parente1449ed956ae29129bde3e5137dde1d579d585ff (diff)
[PATCH] powerpc: 64k pages pmd alloc fix
This patch makes the kernel use a different kmem cache for PMD pages as they are smaller than PTE pages. Avoids waste of memory. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm/init_64.c')
-rw-r--r--arch/powerpc/mm/init_64.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index ce974c83d88a..e274cf10205c 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -20,6 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#undef DEBUG
24
23#include <linux/config.h> 25#include <linux/config.h>
24#include <linux/signal.h> 26#include <linux/signal.h>
25#include <linux/sched.h> 27#include <linux/sched.h>
@@ -64,6 +66,12 @@
64#include <asm/vdso.h> 66#include <asm/vdso.h>
65#include <asm/imalloc.h> 67#include <asm/imalloc.h>
66 68
69#ifdef DEBUG
70#define DBG(fmt...) printk(fmt)
71#else
72#define DBG(fmt...)
73#endif
74
67#if PGTABLE_RANGE > USER_VSID_RANGE 75#if PGTABLE_RANGE > USER_VSID_RANGE
68#warning Limited user VSID range means pagetable space is wasted 76#warning Limited user VSID range means pagetable space is wasted
69#endif 77#endif
@@ -188,14 +196,14 @@ static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
188} 196}
189 197
190#ifdef CONFIG_PPC_64K_PAGES 198#ifdef CONFIG_PPC_64K_PAGES
191static const int pgtable_cache_size[2] = { 199static const unsigned int pgtable_cache_size[3] = {
192 PTE_TABLE_SIZE, PGD_TABLE_SIZE 200 PTE_TABLE_SIZE, PMD_TABLE_SIZE, PGD_TABLE_SIZE
193}; 201};
194static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { 202static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
195 "pte_pmd_cache", "pgd_cache", 203 "pte_pmd_cache", "pmd_cache", "pgd_cache",
196}; 204};
197#else 205#else
198static const int pgtable_cache_size[2] = { 206static const unsigned int pgtable_cache_size[2] = {
199 PTE_TABLE_SIZE, PMD_TABLE_SIZE 207 PTE_TABLE_SIZE, PMD_TABLE_SIZE
200}; 208};
201static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { 209static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
@@ -213,6 +221,8 @@ void pgtable_cache_init(void)
213 int size = pgtable_cache_size[i]; 221 int size = pgtable_cache_size[i];
214 const char *name = pgtable_cache_name[i]; 222 const char *name = pgtable_cache_name[i];
215 223
224 DBG("Allocating page table cache %s (#%d) "
225 "for size: %08x...\n", name, i, size);
216 pgtable_cache[i] = kmem_cache_create(name, 226 pgtable_cache[i] = kmem_cache_create(name,
217 size, size, 227 size, size,
218 SLAB_HWCACHE_ALIGN | 228 SLAB_HWCACHE_ALIGN |