1 #ifndef _LINUX_HUGETLB_H
2 #define _LINUX_HUGETLB_H
13 #ifdef CONFIG_HUGETLB_PAGE
15 #include <linux/mempolicy.h>
16 #include <linux/shm.h>
17 #include <asm/tlbflush.h>
19 struct hugepage_subpool {
22 long max_hpages, used_hpages;
27 #define for_each_hstate(h) \
28 for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++)
36 int hugetlb_sysctl_handler(
struct ctl_table *,
int,
void __user *,
size_t *, loff_t *);
37 int hugetlb_overcommit_handler(
struct ctl_table *,
int,
void __user *,
size_t *, loff_t *);
38 int hugetlb_treat_movable_handler(
struct ctl_table *,
int,
void __user *,
size_t *, loff_t *);
41 int hugetlb_mempolicy_sysctl_handler(
struct ctl_table *,
int,
42 void __user *,
size_t *, loff_t *);
48 unsigned long *,
int *,
int,
unsigned int flags);
50 unsigned long,
unsigned long,
struct page *);
53 unsigned long start,
unsigned long end,
54 struct page *ref_page);
56 unsigned long start,
unsigned long end,
57 struct page *ref_page);
68 int dequeue_hwpoisoned_huge_page(
struct page *
page);
79 unsigned long addr,
unsigned long sz);
109 #define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
110 #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
111 #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
112 #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
116 #define hugetlb_report_node_meminfo(n, buf) 0
117 #define follow_huge_pmd(mm, addr, pmd, write) NULL
118 #define follow_huge_pud(mm, addr, pud, write) NULL
119 #define prepare_hugepage_range(file, addr, len) (-EINVAL)
120 #define pmd_huge(x) 0
121 #define pud_huge(x) 0
122 #define is_hugepage_only_range(mm, addr, len) 0
123 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
124 #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
125 #define huge_pte_offset(mm, address) 0
126 static inline int dequeue_hwpoisoned_huge_page(
struct page *
page)
135 #define hugetlb_change_protection(vma, address, end, newprot)
139 unsigned long end,
struct page *ref_page)
146 unsigned long end,
struct page *ref_page)
153 #define HUGETLB_ANON_FILE "anon_hugepage"
168 #ifdef CONFIG_HUGETLBFS
169 struct hugetlbfs_sb_info {
174 struct hugepage_subpool *spool;
177 static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(
struct super_block *
sb)
200 #define is_file_hugepages(file) 0
201 static inline struct file *
210 #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
212 unsigned long len,
unsigned long pgoff,
213 unsigned long flags);
216 #ifdef CONFIG_HUGETLB_PAGE
218 #define HSTATE_NAME_LEN 32
221 int next_nid_to_alloc;
222 int next_nid_to_free;
225 unsigned long max_huge_pages;
226 unsigned long nr_huge_pages;
227 unsigned long free_huge_pages;
228 unsigned long resv_huge_pages;
229 unsigned long surplus_huge_pages;
230 unsigned long nr_overcommit_huge_pages;
236 #ifdef CONFIG_CGROUP_HUGETLB
238 struct cftype cgroup_files[5];
240 char name[HSTATE_NAME_LEN];
243 struct huge_bootmem_page {
246 #ifdef CONFIG_HIGHMEM
259 #ifndef HUGE_MAX_HSTATE
260 #define HUGE_MAX_HSTATE 1
266 #define default_hstate (hstates[default_hstate_idx])
270 struct hugetlbfs_sb_info *hsb;
271 hsb = HUGETLBFS_SB(i->
i_sb);
287 return (
unsigned long)
PAGE_SIZE << h->order;
309 static inline unsigned int pages_per_huge_page(
struct hstate *h)
311 return 1 << h->order;
314 static inline unsigned int blocks_per_huge_page(
struct hstate *h)
319 #include <asm/hugetlb.h>
321 #ifndef arch_make_huge_pte
346 #define alloc_huge_page_node(h, nid) NULL
347 #define alloc_bootmem_huge_page(h) NULL
348 #define hstate_file(f) NULL
349 #define hstate_vma(v) NULL
350 #define hstate_inode(i) NULL
351 #define huge_page_size(h) PAGE_SIZE
352 #define huge_page_mask(h) PAGE_MASK
353 #define vma_kernel_pagesize(v) PAGE_SIZE
354 #define vma_mmu_pagesize(v) PAGE_SIZE
355 #define huge_page_order(h) 0
356 #define huge_page_shift(h) PAGE_SHIFT
357 static inline unsigned int pages_per_huge_page(
struct hstate *h)
361 #define hstate_index_to_shift(index) 0
362 #define hstate_index(h) 0