Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* $Id: pgalloc.h,v 1.30 2001/12/21 04:56:17 davem Exp $ */ |
2 | #ifndef _SPARC64_PGALLOC_H | |
3 | #define _SPARC64_PGALLOC_H | |
4 | ||
1da177e4 LT |
5 | #include <linux/kernel.h> |
6 | #include <linux/sched.h> | |
7 | #include <linux/mm.h> | |
3c936465 | 8 | #include <linux/slab.h> |
3a2cba99 | 9 | #include <linux/quicklist.h> |
1da177e4 LT |
10 | |
11 | #include <asm/spitfire.h> | |
12 | #include <asm/cpudata.h> | |
13 | #include <asm/cacheflush.h> | |
6a9b490d | 14 | #include <asm/page.h> |
1da177e4 LT |
15 | |
16 | /* Page table allocation/freeing. */ | |
1da177e4 | 17 | |
3c936465 | 18 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
1da177e4 | 19 | { |
3a2cba99 | 20 | return quicklist_alloc(0, GFP_KERNEL, NULL); |
1da177e4 LT |
21 | } |
22 | ||
3c936465 | 23 | static inline void pgd_free(pgd_t *pgd) |
1da177e4 | 24 | { |
3a2cba99 | 25 | quicklist_free(0, NULL, pgd); |
1da177e4 LT |
26 | } |
27 | ||
1da177e4 LT |
28 | #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) |
29 | ||
3c936465 | 30 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
1da177e4 | 31 | { |
3a2cba99 | 32 | return quicklist_alloc(0, GFP_KERNEL, NULL); |
05e28f9d DM |
33 | } |
34 | ||
3c936465 | 35 | static inline void pmd_free(pmd_t *pmd) |
05e28f9d | 36 | { |
3a2cba99 | 37 | quicklist_free(0, NULL, pmd); |
1da177e4 LT |
38 | } |
39 | ||
3c936465 DM |
40 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
41 | unsigned long address) | |
1da177e4 | 42 | { |
3a2cba99 | 43 | return quicklist_alloc(0, GFP_KERNEL, NULL); |
05e28f9d DM |
44 | } |
45 | ||
3c936465 DM |
46 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
47 | unsigned long address) | |
05e28f9d | 48 | { |
3a2cba99 DM |
49 | void *pg = quicklist_alloc(0, GFP_KERNEL, NULL); |
50 | return pg ? virt_to_page(pg) : NULL; | |
1da177e4 | 51 | } |
3c936465 | 52 | |
1da177e4 LT |
53 | static inline void pte_free_kernel(pte_t *pte) |
54 | { | |
3a2cba99 | 55 | quicklist_free(0, NULL, pte); |
1da177e4 LT |
56 | } |
57 | ||
58 | static inline void pte_free(struct page *ptepage) | |
59 | { | |
3a2cba99 | 60 | quicklist_free_page(0, NULL, ptepage); |
1da177e4 LT |
61 | } |
62 | ||
3c936465 DM |
63 | |
64 | #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE) | |
65 | #define pmd_populate(MM,PMD,PTE_PAGE) \ | |
66 | pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE)) | |
67 | ||
3a2cba99 DM |
68 | static inline void check_pgt_cache(void) |
69 | { | |
70 | quicklist_trim(0, NULL, 25, 16); | |
71 | } | |
1da177e4 LT |
72 | |
73 | #endif /* _SPARC64_PGALLOC_H */ |