diff options
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r-- | include/linux/hugetlb.h | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d5d6bbe2259e..225164842ab6 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -4,9 +4,11 @@ | |||
4 | #include <linux/mm_types.h> | 4 | #include <linux/mm_types.h> |
5 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
6 | #include <linux/hugetlb_inline.h> | 6 | #include <linux/hugetlb_inline.h> |
7 | #include <linux/cgroup.h> | ||
7 | 8 | ||
8 | struct ctl_table; | 9 | struct ctl_table; |
9 | struct user_struct; | 10 | struct user_struct; |
11 | struct mmu_gather; | ||
10 | 12 | ||
11 | #ifdef CONFIG_HUGETLB_PAGE | 13 | #ifdef CONFIG_HUGETLB_PAGE |
12 | 14 | ||
@@ -20,6 +22,11 @@ struct hugepage_subpool { | |||
20 | long max_hpages, used_hpages; | 22 | long max_hpages, used_hpages; |
21 | }; | 23 | }; |
22 | 24 | ||
25 | extern spinlock_t hugetlb_lock; | ||
26 | extern int hugetlb_max_hstate __read_mostly; | ||
27 | #define for_each_hstate(h) \ | ||
28 | for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++) | ||
29 | |||
23 | struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); | 30 | struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); |
24 | void hugepage_put_subpool(struct hugepage_subpool *spool); | 31 | void hugepage_put_subpool(struct hugepage_subpool *spool); |
25 | 32 | ||
@@ -40,9 +47,14 @@ int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, | |||
40 | struct page **, struct vm_area_struct **, | 47 | struct page **, struct vm_area_struct **, |
41 | unsigned long *, int *, int, unsigned int flags); | 48 | unsigned long *, int *, int, unsigned int flags); |
42 | void unmap_hugepage_range(struct vm_area_struct *, | 49 | void unmap_hugepage_range(struct vm_area_struct *, |
43 | unsigned long, unsigned long, struct page *); | 50 | unsigned long, unsigned long, struct page *); |
44 | void __unmap_hugepage_range(struct vm_area_struct *, | 51 | void __unmap_hugepage_range_final(struct mmu_gather *tlb, |
45 | unsigned long, unsigned long, struct page *); | 52 | struct vm_area_struct *vma, |
53 | unsigned long start, unsigned long end, | ||
54 | struct page *ref_page); | ||
55 | void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, | ||
56 | unsigned long start, unsigned long end, | ||
57 | struct page *ref_page); | ||
46 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 58 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
47 | void hugetlb_report_meminfo(struct seq_file *); | 59 | void hugetlb_report_meminfo(struct seq_file *); |
48 | int hugetlb_report_node_meminfo(int, char *); | 60 | int hugetlb_report_node_meminfo(int, char *); |
@@ -98,7 +110,6 @@ static inline unsigned long hugetlb_total_pages(void) | |||
98 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | 110 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) |
99 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 111 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
100 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 112 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
101 | #define unmap_hugepage_range(vma, start, end, page) BUG() | ||
102 | static inline void hugetlb_report_meminfo(struct seq_file *m) | 113 | static inline void hugetlb_report_meminfo(struct seq_file *m) |
103 | { | 114 | { |
104 | } | 115 | } |
@@ -112,13 +123,31 @@ static inline void hugetlb_report_meminfo(struct seq_file *m) | |||
112 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | 123 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) |
113 | #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) | 124 | #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) |
114 | #define huge_pte_offset(mm, address) 0 | 125 | #define huge_pte_offset(mm, address) 0 |
115 | #define dequeue_hwpoisoned_huge_page(page) 0 | 126 | static inline int dequeue_hwpoisoned_huge_page(struct page *page) |
127 | { | ||
128 | return 0; | ||
129 | } | ||
130 | |||
116 | static inline void copy_huge_page(struct page *dst, struct page *src) | 131 | static inline void copy_huge_page(struct page *dst, struct page *src) |
117 | { | 132 | { |
118 | } | 133 | } |
119 | 134 | ||
120 | #define hugetlb_change_protection(vma, address, end, newprot) | 135 | #define hugetlb_change_protection(vma, address, end, newprot) |
121 | 136 | ||
137 | static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb, | ||
138 | struct vm_area_struct *vma, unsigned long start, | ||
139 | unsigned long end, struct page *ref_page) | ||
140 | { | ||
141 | BUG(); | ||
142 | } | ||
143 | |||
144 | static inline void __unmap_hugepage_range(struct mmu_gather *tlb, | ||
145 | struct vm_area_struct *vma, unsigned long start, | ||
146 | unsigned long end, struct page *ref_page) | ||
147 | { | ||
148 | BUG(); | ||
149 | } | ||
150 | |||
122 | #endif /* !CONFIG_HUGETLB_PAGE */ | 151 | #endif /* !CONFIG_HUGETLB_PAGE */ |
123 | 152 | ||
124 | #define HUGETLB_ANON_FILE "anon_hugepage" | 153 | #define HUGETLB_ANON_FILE "anon_hugepage" |
@@ -199,10 +228,15 @@ struct hstate { | |||
199 | unsigned long resv_huge_pages; | 228 | unsigned long resv_huge_pages; |
200 | unsigned long surplus_huge_pages; | 229 | unsigned long surplus_huge_pages; |
201 | unsigned long nr_overcommit_huge_pages; | 230 | unsigned long nr_overcommit_huge_pages; |
231 | struct list_head hugepage_activelist; | ||
202 | struct list_head hugepage_freelists[MAX_NUMNODES]; | 232 | struct list_head hugepage_freelists[MAX_NUMNODES]; |
203 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; | 233 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; |
204 | unsigned int free_huge_pages_node[MAX_NUMNODES]; | 234 | unsigned int free_huge_pages_node[MAX_NUMNODES]; |
205 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; | 235 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; |
236 | #ifdef CONFIG_CGROUP_HUGETLB | ||
237 | /* cgroup control files */ | ||
238 | struct cftype cgroup_files[5]; | ||
239 | #endif | ||
206 | char name[HSTATE_NAME_LEN]; | 240 | char name[HSTATE_NAME_LEN]; |
207 | }; | 241 | }; |
208 | 242 | ||
@@ -302,6 +336,11 @@ static inline unsigned hstate_index_to_shift(unsigned index) | |||
302 | return hstates[index].order + PAGE_SHIFT; | 336 | return hstates[index].order + PAGE_SHIFT; |
303 | } | 337 | } |
304 | 338 | ||
339 | static inline int hstate_index(struct hstate *h) | ||
340 | { | ||
341 | return h - hstates; | ||
342 | } | ||
343 | |||
305 | #else | 344 | #else |
306 | struct hstate {}; | 345 | struct hstate {}; |
307 | #define alloc_huge_page_node(h, nid) NULL | 346 | #define alloc_huge_page_node(h, nid) NULL |
@@ -320,6 +359,7 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) | |||
320 | return 1; | 359 | return 1; |
321 | } | 360 | } |
322 | #define hstate_index_to_shift(index) 0 | 361 | #define hstate_index_to_shift(index) 0 |
362 | #define hstate_index(h) 0 | ||
323 | #endif | 363 | #endif |
324 | 364 | ||
325 | #endif /* _LINUX_HUGETLB_H */ | 365 | #endif /* _LINUX_HUGETLB_H */ |