aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r--include/linux/hugetlb.h16
1 files changed, 3 insertions, 13 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 42cb7d70f9ac..d664330d900e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -25,6 +25,8 @@ int is_hugepage_mem_enough(size_t);
25unsigned long hugetlb_total_pages(void); 25unsigned long hugetlb_total_pages(void);
26struct page *alloc_huge_page(void); 26struct page *alloc_huge_page(void);
27void free_huge_page(struct page *); 27void free_huge_page(struct page *);
28int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
29 unsigned long address, int write_access);
28 30
29extern unsigned long max_huge_pages; 31extern unsigned long max_huge_pages;
30extern const unsigned long hugetlb_zero, hugetlb_infinity; 32extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -99,6 +101,7 @@ static inline unsigned long hugetlb_total_pages(void)
99 do { } while (0) 101 do { } while (0)
100#define alloc_huge_page() ({ NULL; }) 102#define alloc_huge_page() ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); }) 103#define free_huge_page(p) ({ (void)(p); BUG(); })
104#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
102 105
103#ifndef HPAGE_MASK 106#ifndef HPAGE_MASK
104#define HPAGE_MASK 0 /* Keep the compiler happy */ 107#define HPAGE_MASK 0 /* Keep the compiler happy */
@@ -155,24 +158,11 @@ static inline void set_file_hugepages(struct file *file)
155{ 158{
156 file->f_op = &hugetlbfs_file_operations; 159 file->f_op = &hugetlbfs_file_operations;
157} 160}
158
159static inline int valid_hugetlb_file_off(struct vm_area_struct *vma,
160 unsigned long address)
161{
162 struct inode *inode = vma->vm_file->f_dentry->d_inode;
163 loff_t file_off = address - vma->vm_start;
164
165 file_off += (vma->vm_pgoff << PAGE_SHIFT);
166
167 return (file_off < inode->i_size);
168}
169
170#else /* !CONFIG_HUGETLBFS */ 161#else /* !CONFIG_HUGETLBFS */
171 162
172#define is_file_hugepages(file) 0 163#define is_file_hugepages(file) 0
173#define set_file_hugepages(file) BUG() 164#define set_file_hugepages(file) BUG()
174#define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) 165#define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS)
175#define valid_hugetlb_file_off(vma, address) 0
176 166
177#endif /* !CONFIG_HUGETLBFS */ 167#endif /* !CONFIG_HUGETLBFS */
178 168