Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_HUGETLB_H |
2 | #define _LINUX_HUGETLB_H |
||
3 | |||
4 | #ifdef CONFIG_HUGETLB_PAGE |
||
5 | |||
6 | struct ctl_table; |
||
7 | |||
8 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
||
9 | { |
||
10 | return vma->vm_flags & VM_HUGETLB; |
||
11 | } |
||
12 | |||
13 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void *, size_t *); |
||
14 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
||
15 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); |
||
16 | void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); |
||
17 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); |
||
18 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
||
19 | void huge_page_release(struct page *); |
||
20 | int hugetlb_report_meminfo(char *); |
||
21 | int is_hugepage_mem_enough(size_t); |
||
22 | struct page *follow_huge_addr(struct mm_struct *mm, struct vm_area_struct *vma, |
||
23 | unsigned long address, int write); |
||
24 | struct vm_area_struct *hugepage_vma(struct mm_struct *mm, |
||
25 | unsigned long address); |
||
26 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, |
||
27 | pmd_t *pmd, int write); |
||
28 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); |
||
29 | int pmd_huge(pmd_t pmd); |
||
30 | |||
31 | extern int htlbpage_max; |
||
32 | |||
33 | static inline void |
||
34 | mark_mm_hugetlb(struct mm_struct *mm, struct vm_area_struct *vma) |
||
35 | { |
||
36 | if (is_vm_hugetlb_page(vma)) |
||
37 | mm->used_hugetlb = 1; |
||
38 | } |
||
39 | |||
40 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE |
||
41 | #define is_hugepage_only_range(addr, len) 0 |
||
42 | #endif |
||
43 | |||
44 | #else /* !CONFIG_HUGETLB_PAGE */ |
||
45 | |||
46 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
||
47 | { |
||
48 | return 0; |
||
49 | } |
||
50 | |||
51 | #define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; }) |
||
52 | #define follow_huge_addr(mm, vma, addr, write) 0 |
||
53 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
||
54 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
||
55 | #define zap_hugepage_range(vma, start, len) BUG() |
||
56 | #define unmap_hugepage_range(vma, start, end) BUG() |
||
57 | #define huge_page_release(page) BUG() |
||
58 | #define is_hugepage_mem_enough(size) 0 |
||
59 | #define hugetlb_report_meminfo(buf) 0 |
||
60 | #define hugepage_vma(mm, addr) 0 |
||
61 | #define mark_mm_hugetlb(mm, vma) do { } while (0) |
||
62 | #define follow_huge_pmd(mm, addr, pmd, write) 0 |
||
63 | #define is_aligned_hugepage_range(addr, len) 0 |
||
64 | #define pmd_huge(x) 0 |
||
65 | #define is_hugepage_only_range(addr, len) 0 |
||
66 | |||
67 | #ifndef HPAGE_MASK |
||
68 | #define HPAGE_MASK 0 /* Keep the compiler happy */ |
||
69 | #define HPAGE_SIZE 0 |
||
70 | #endif |
||
71 | |||
72 | #endif /* !CONFIG_HUGETLB_PAGE */ |
||
73 | |||
74 | #ifdef CONFIG_HUGETLBFS |
||
75 | struct hugetlbfs_config { |
||
76 | uid_t uid; |
||
77 | gid_t gid; |
||
78 | umode_t mode; |
||
79 | long nr_blocks; |
||
80 | long nr_inodes; |
||
81 | }; |
||
82 | |||
83 | struct hugetlbfs_sb_info { |
||
84 | long max_blocks; /* blocks allowed */ |
||
85 | long free_blocks; /* blocks free */ |
||
86 | long max_inodes; /* inodes allowed */ |
||
87 | long free_inodes; /* inodes free */ |
||
88 | spinlock_t stat_lock; |
||
89 | }; |
||
90 | |||
91 | static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) |
||
92 | { |
||
93 | return sb->s_fs_info; |
||
94 | } |
||
95 | |||
96 | #define PSEUDO_DIRENT_SIZE 20 |
||
97 | |||
98 | extern struct file_operations hugetlbfs_file_operations; |
||
99 | extern struct vm_operations_struct hugetlb_vm_ops; |
||
100 | struct file *hugetlb_zero_setup(size_t); |
||
101 | int hugetlb_get_quota(struct address_space *mapping); |
||
102 | void hugetlb_put_quota(struct address_space *mapping); |
||
103 | |||
104 | static inline int is_file_hugepages(struct file *file) |
||
105 | { |
||
106 | return file->f_op == &hugetlbfs_file_operations; |
||
107 | } |
||
108 | |||
109 | static inline void set_file_hugepages(struct file *file) |
||
110 | { |
||
111 | file->f_op = &hugetlbfs_file_operations; |
||
112 | } |
||
113 | #else /* !CONFIG_HUGETLBFS */ |
||
114 | |||
115 | #define is_file_hugepages(file) 0 |
||
116 | #define set_file_hugepages(file) BUG() |
||
117 | #define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) |
||
118 | |||
119 | #endif /* !CONFIG_HUGETLBFS */ |
||
120 | |||
121 | #endif /* _LINUX_HUGETLB_H */ |