diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-01-14 17:33:44 -0500 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-07-02 05:01:29 -0400 |
commit | 5a4d5292779b6163aa41e594a56307e442fbe73c (patch) | |
tree | 39c9e13e248a8cb91c08a979b7432a48da63240b /include/asm-avr32 | |
parent | a9a934f278613885816aa9f177968c1dac557240 (diff) |
avr32: Use a quicklist for PGD allocation
Use a quicklist to allocate process PGDs. This is expected to be
slightly faster since we need to copy entries from swapper_pg_dir,
which can stay around for pages on the PGD quick list.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'include/asm-avr32')
-rw-r--r-- | include/asm-avr32/pgalloc.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h index e9636d1f383f..a291f59659cf 100644 --- a/include/asm-avr32/pgalloc.h +++ b/include/asm-avr32/pgalloc.h | |||
@@ -8,7 +8,11 @@ | |||
8 | #ifndef __ASM_AVR32_PGALLOC_H | 8 | #ifndef __ASM_AVR32_PGALLOC_H |
9 | #define __ASM_AVR32_PGALLOC_H | 9 | #define __ASM_AVR32_PGALLOC_H |
10 | 10 | ||
11 | #include <linux/mm.h> | 11 | #include <linux/quicklist.h> |
12 | #include <asm/page.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | |||
15 | #define QUICK_PGD 0 /* Preserve kernel mappings over free */ | ||
12 | 16 | ||
13 | static inline void pmd_populate_kernel(struct mm_struct *mm, | 17 | static inline void pmd_populate_kernel(struct mm_struct *mm, |
14 | pmd_t *pmd, pte_t *pte) | 18 | pmd_t *pmd, pte_t *pte) |
@@ -23,25 +27,26 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
23 | } | 27 | } |
24 | #define pmd_pgtable(pmd) pmd_page(pmd) | 28 | #define pmd_pgtable(pmd) pmd_page(pmd) |
25 | 29 | ||
30 | static inline void pgd_ctor(void *x) | ||
31 | { | ||
32 | pgd_t *pgd = x; | ||
33 | |||
34 | memcpy(pgd + USER_PTRS_PER_PGD, | ||
35 | swapper_pg_dir + USER_PTRS_PER_PGD, | ||
36 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
37 | } | ||
38 | |||
26 | /* | 39 | /* |
27 | * Allocate and free page tables | 40 | * Allocate and free page tables |
28 | */ | 41 | */ |
29 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 42 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
30 | { | 43 | { |
31 | pgd_t *pgd; | 44 | return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor); |
32 | |||
33 | pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); | ||
34 | if (likely(pgd)) | ||
35 | memcpy(pgd + USER_PTRS_PER_PGD, | ||
36 | swapper_pg_dir + USER_PTRS_PER_PGD, | ||
37 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
38 | |||
39 | return pgd; | ||
40 | } | 45 | } |
41 | 46 | ||
42 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 47 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
43 | { | 48 | { |
44 | free_page((unsigned long)pgd); | 49 | quicklist_free(QUICK_PGD, NULL, pgd); |
45 | } | 50 | } |
46 | 51 | ||
47 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 52 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
@@ -83,6 +88,9 @@ do { \ | |||
83 | tlb_remove_page((tlb), pte); \ | 88 | tlb_remove_page((tlb), pte); \ |
84 | } while (0) | 89 | } while (0) |
85 | 90 | ||
86 | #define check_pgt_cache() do { } while(0) | 91 | static inline void check_pgt_cache(void) |
92 | { | ||
93 | quicklist_trim(QUICK_PGD, NULL, 25, 16); | ||
94 | } | ||
87 | 95 | ||
88 | #endif /* __ASM_AVR32_PGALLOC_H */ | 96 | #endif /* __ASM_AVR32_PGALLOC_H */ |