Commit 87655ff2 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras

[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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent e1449ed9
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* *
*/ */
#undef DEBUG
#include <linux/config.h> #include <linux/config.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -64,6 +66,12 @@ ...@@ -64,6 +66,12 @@
#include <asm/vdso.h> #include <asm/vdso.h>
#include <asm/imalloc.h> #include <asm/imalloc.h>
#ifdef DEBUG
#define DBG(fmt...) printk(fmt)
#else
#define DBG(fmt...)
#endif
#if PGTABLE_RANGE > USER_VSID_RANGE #if PGTABLE_RANGE > USER_VSID_RANGE
#warning Limited user VSID range means pagetable space is wasted #warning Limited user VSID range means pagetable space is wasted
#endif #endif
...@@ -188,14 +196,14 @@ static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags) ...@@ -188,14 +196,14 @@ static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
} }
#ifdef CONFIG_PPC_64K_PAGES #ifdef CONFIG_PPC_64K_PAGES
static const int pgtable_cache_size[2] = { static const unsigned int pgtable_cache_size[3] = {
PTE_TABLE_SIZE, PGD_TABLE_SIZE PTE_TABLE_SIZE, PMD_TABLE_SIZE, PGD_TABLE_SIZE
}; };
static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
"pte_pmd_cache", "pgd_cache", "pte_pmd_cache", "pmd_cache", "pgd_cache",
}; };
#else #else
static const int pgtable_cache_size[2] = { static const unsigned int pgtable_cache_size[2] = {
PTE_TABLE_SIZE, PMD_TABLE_SIZE PTE_TABLE_SIZE, PMD_TABLE_SIZE
}; };
static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
...@@ -213,6 +221,8 @@ void pgtable_cache_init(void) ...@@ -213,6 +221,8 @@ void pgtable_cache_init(void)
int size = pgtable_cache_size[i]; int size = pgtable_cache_size[i];
const char *name = pgtable_cache_name[i]; const char *name = pgtable_cache_name[i];
DBG("Allocating page table cache %s (#%d) "
"for size: %08x...\n", name, i, size);
pgtable_cache[i] = kmem_cache_create(name, pgtable_cache[i] = kmem_cache_create(name,
size, size, size, size,
SLAB_HWCACHE_ALIGN | SLAB_HWCACHE_ALIGN |
......
...@@ -10,8 +10,8 @@ extern kmem_cache_t *pgtable_cache[]; ...@@ -10,8 +10,8 @@ extern kmem_cache_t *pgtable_cache[];
#ifdef CONFIG_PPC_64K_PAGES #ifdef CONFIG_PPC_64K_PAGES
#define PTE_CACHE_NUM 0 #define PTE_CACHE_NUM 0
#define PMD_CACHE_NUM 0 #define PMD_CACHE_NUM 1
#define PGD_CACHE_NUM 1 #define PGD_CACHE_NUM 2
#else #else
#define PTE_CACHE_NUM 0 #define PTE_CACHE_NUM 0
#define PMD_CACHE_NUM 1 #define PMD_CACHE_NUM 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment