This source file includes following definitions.
- __pte_alloc_one_kernel
- pte_alloc_one_kernel
- pte_free_kernel
- __pte_alloc_one
- pte_alloc_one
- pte_free
1
2 #ifndef __ASM_GENERIC_PGALLOC_H
3 #define __ASM_GENERIC_PGALLOC_H
4
5 #ifdef CONFIG_MMU
6
7 #define GFP_PGTABLE_KERNEL (GFP_KERNEL | __GFP_ZERO)
8 #define GFP_PGTABLE_USER (GFP_PGTABLE_KERNEL | __GFP_ACCOUNT)
9
10
11
12
13
14
15
16
17
18
19 static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm)
20 {
21 return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL);
22 }
23
24 #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
25
26
27
28
29
30
31 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
32 {
33 return __pte_alloc_one_kernel(mm);
34 }
35 #endif
36
37
38
39
40
41
42 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
43 {
44 free_page((unsigned long)pte);
45 }
46
47
48
49
50
51
52
53
54
55
56
57
58
59 static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp)
60 {
61 struct page *pte;
62
63 pte = alloc_page(gfp);
64 if (!pte)
65 return NULL;
66 if (!pgtable_pte_page_ctor(pte)) {
67 __free_page(pte);
68 return NULL;
69 }
70
71 return pte;
72 }
73
74 #ifndef __HAVE_ARCH_PTE_ALLOC_ONE
75
76
77
78
79
80
81
82
83 static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
84 {
85 return __pte_alloc_one(mm, GFP_PGTABLE_USER);
86 }
87 #endif
88
89
90
91
92
93
94
95
96
97
98
99 static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
100 {
101 pgtable_pte_page_dtor(pte_page);
102 __free_page(pte_page);
103 }
104
105 #endif
106
107 #endif