sh: Abstract the number of page table levels
[pandora-kernel.git] / arch / sh / include / asm / pgalloc_nopmd.h
1 #ifndef __ASM_SH_PGALLOC_NOPMD_H
2 #define __ASM_SH_PGALLOC_NOPMD_H
3
4 #define QUICK_PGD 0     /* We preserve special mappings over free */
5
6 static inline void pgd_ctor(void *x)
7 {
8         pgd_t *pgd = x;
9
10         memcpy(pgd + USER_PTRS_PER_PGD,
11                swapper_pg_dir + USER_PTRS_PER_PGD,
12                (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
13 }
14
15 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
16 {
17         return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
18 }
19
20 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
21 {
22         quicklist_free(QUICK_PGD, NULL, pgd);
23 }
24
25 static inline void __check_pgt_cache(void)
26 {
27         quicklist_trim(QUICK_PGD, NULL, 25, 16);
28 }
29
30 #endif /* __ASM_SH_PGALLOC_NOPMD_H */