diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-01-14 17:35:32 -0500 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-07-02 05:01:29 -0400 |
commit | 38510754a50192a072210e24fdc4ae65592182f0 (patch) | |
tree | f14de78921e4e6a5f56aee93d5ba921c57c2a82f /include/asm-avr32/pgalloc.h | |
parent | 5a4d5292779b6163aa41e594a56307e442fbe73c (diff) |
avr32: Use a quicklist for PTE allocation as well
Using a quicklist to allocate PTEs might be slightly faster than using
the page allocator directly since we might avoid zeroing the page
after each allocation.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'include/asm-avr32/pgalloc.h')
-rw-r--r-- | include/asm-avr32/pgalloc.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h index a291f59659cf..640821323943 100644 --- a/include/asm-avr32/pgalloc.h +++ b/include/asm-avr32/pgalloc.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
14 | 14 | ||
15 | #define QUICK_PGD 0 /* Preserve kernel mappings over free */ | 15 | #define QUICK_PGD 0 /* Preserve kernel mappings over free */ |
16 | #define QUICK_PT 1 /* Zero on free */ | ||
16 | 17 | ||
17 | static inline void pmd_populate_kernel(struct mm_struct *mm, | 18 | static inline void pmd_populate_kernel(struct mm_struct *mm, |
18 | pmd_t *pmd, pte_t *pte) | 19 | pmd_t *pmd, pte_t *pte) |
@@ -52,34 +53,34 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
52 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 53 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
53 | unsigned long address) | 54 | unsigned long address) |
54 | { | 55 | { |
55 | pte_t *pte; | 56 | return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); |
56 | |||
57 | pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); | ||
58 | |||
59 | return pte; | ||
60 | } | 57 | } |
61 | 58 | ||
62 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 59 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, |
63 | unsigned long address) | 60 | unsigned long address) |
64 | { | 61 | { |
65 | struct page *pte; | 62 | struct page *page; |
63 | void *pg; | ||
66 | 64 | ||
67 | pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); | 65 | pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); |
68 | if (!pte) | 66 | if (!pg) |
69 | return NULL; | 67 | return NULL; |
70 | pgtable_page_ctor(pte); | 68 | |
71 | return pte; | 69 | page = virt_to_page(pg); |
70 | pgtable_page_ctor(page); | ||
71 | |||
72 | return page; | ||
72 | } | 73 | } |
73 | 74 | ||
74 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | 75 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
75 | { | 76 | { |
76 | free_page((unsigned long)pte); | 77 | quicklist_free(QUICK_PT, NULL, pte); |
77 | } | 78 | } |
78 | 79 | ||
79 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | 80 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) |
80 | { | 81 | { |
81 | pgtable_page_dtor(pte); | 82 | pgtable_page_dtor(pte); |
82 | __free_page(pte); | 83 | quicklist_free_page(QUICK_PT, NULL, pte); |
83 | } | 84 | } |
84 | 85 | ||
85 | #define __pte_free_tlb(tlb,pte) \ | 86 | #define __pte_free_tlb(tlb,pte) \ |
@@ -91,6 +92,7 @@ do { \ | |||
91 | static inline void check_pgt_cache(void) | 92 | static inline void check_pgt_cache(void) |
92 | { | 93 | { |
93 | quicklist_trim(QUICK_PGD, NULL, 25, 16); | 94 | quicklist_trim(QUICK_PGD, NULL, 25, 16); |
95 | quicklist_trim(QUICK_PT, NULL, 25, 16); | ||
94 | } | 96 | } |
95 | 97 | ||
96 | #endif /* __ASM_AVR32_PGALLOC_H */ | 98 | #endif /* __ASM_AVR32_PGALLOC_H */ |