aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-avr32
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-01-14 23:11:26 +0100
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-02 11:01:29 +0200
commita9a934f278613885816aa9f177968c1dac557240 (patch)
treee2199d8039f548c88f95dd82ee87fc254d972767 /include/asm-avr32
parentavr32: Store virtual addresses in the PGD (diff)
downloadlinux-dev-a9a934f278613885816aa9f177968c1dac557240.tar.xz
linux-dev-a9a934f278613885816aa9f177968c1dac557240.zip
avr32: Cover the kernel page tables in the user PGDs
Expand the per-process PGDs so that they cover the kernel virtual memory area as well. This simplifies the TLB miss handler fastpath since it doesn't have to check for kernel addresses anymore. If a TLB miss happens on a kernel address and a second-level page table can't be found, we check swapper_pg_dir and copy the PGD entry into the user PGD if it can be found there. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'include/asm-avr32')
-rw-r--r--include/asm-avr32/pgalloc.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h
index 5b768fc2388e..e9636d1f383f 100644
--- a/include/asm-avr32/pgalloc.h
+++ b/include/asm-avr32/pgalloc.h
@@ -9,8 +9,6 @@
#define __ASM_AVR32_PGALLOC_H
#include <linux/mm.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
static inline void pmd_populate_kernel(struct mm_struct *mm,
pmd_t *pmd, pte_t *pte)
@@ -30,12 +28,20 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
*/
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
- return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL);
+ pgd_t *pgd;
+
+ pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT);
+ if (likely(pgd))
+ memcpy(pgd + USER_PTRS_PER_PGD,
+ swapper_pg_dir + USER_PTRS_PER_PGD,
+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+
+ return pgd;
}
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
- kfree(pgd);
+ free_page((unsigned long)pgd);
}
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,