aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/pgalloc.h
diff options
context:
space:
mode:
authorMatt Fleming <matt@console-pimps.org>2009-11-25 17:00:08 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-12-17 00:31:15 -0500
commitb73c806341cfc7492ede6a2ce713cb579547d0ab (patch)
tree9318727eab90409f518c95031445063e93c0a651 /arch/sh/include/asm/pgalloc.h
parent2f7bb2dfed3b15b388c88250b66f590aabc438da (diff)
sh: Abstract the number of page table levels
Keep the dimensions of the page tables in a separate header file in preparation for allowing a three level page table structure. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm/pgalloc.h')
-rw-r--r--arch/sh/include/asm/pgalloc.h24
1 files changed, 3 insertions, 21 deletions
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index 63ca37bd9a95..fe9f037ac5fd 100644
--- a/arch/sh/include/asm/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
@@ -4,9 +4,10 @@
4#include <linux/quicklist.h> 4#include <linux/quicklist.h>
5#include <asm/page.h> 5#include <asm/page.h>
6 6
7#define QUICK_PGD 0 /* We preserve special mappings over free */
8#define QUICK_PT 1 /* Other page table pages that are zero on free */ 7#define QUICK_PT 1 /* Other page table pages that are zero on free */
9 8
9#include <asm/pgalloc_nopmd.h>
10
10static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, 11static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
11 pte_t *pte) 12 pte_t *pte)
12{ 13{
@@ -20,28 +21,9 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
20} 21}
21#define pmd_pgtable(pmd) pmd_page(pmd) 22#define pmd_pgtable(pmd) pmd_page(pmd)
22 23
23static inline void pgd_ctor(void *x)
24{
25 pgd_t *pgd = x;
26
27 memcpy(pgd + USER_PTRS_PER_PGD,
28 swapper_pg_dir + USER_PTRS_PER_PGD,
29 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
30}
31
32/* 24/*
33 * Allocate and free page tables. 25 * Allocate and free page tables.
34 */ 26 */
35static inline pgd_t *pgd_alloc(struct mm_struct *mm)
36{
37 return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
38}
39
40static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
41{
42 quicklist_free(QUICK_PGD, NULL, pgd);
43}
44
45static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 27static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
46 unsigned long address) 28 unsigned long address)
47{ 29{
@@ -81,7 +63,7 @@ do { \
81 63
82static inline void check_pgt_cache(void) 64static inline void check_pgt_cache(void)
83{ 65{
84 quicklist_trim(QUICK_PGD, NULL, 25, 16); 66 __check_pgt_cache();
85 quicklist_trim(QUICK_PT, NULL, 25, 16); 67 quicklist_trim(QUICK_PT, NULL, 25, 16);
86} 68}
87 69