diff options
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r-- | include/linux/hugetlb.h | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 68d82ad6b17c..d6f1019625af 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -20,10 +20,7 @@ void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long) | |||
20 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 20 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
21 | int hugetlb_report_meminfo(char *); | 21 | int hugetlb_report_meminfo(char *); |
22 | int hugetlb_report_node_meminfo(int, char *); | 22 | int hugetlb_report_node_meminfo(int, char *); |
23 | int is_hugepage_mem_enough(size_t); | ||
24 | unsigned long hugetlb_total_pages(void); | 23 | unsigned long hugetlb_total_pages(void); |
25 | struct page *alloc_huge_page(struct vm_area_struct *, unsigned long); | ||
26 | void free_huge_page(struct page *); | ||
27 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 24 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
28 | unsigned long address, int write_access); | 25 | unsigned long address, int write_access); |
29 | 26 | ||
@@ -39,18 +36,35 @@ struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | |||
39 | int write); | 36 | int write); |
40 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | 37 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, |
41 | pmd_t *pmd, int write); | 38 | pmd_t *pmd, int write); |
42 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); | ||
43 | int pmd_huge(pmd_t pmd); | 39 | int pmd_huge(pmd_t pmd); |
40 | void hugetlb_change_protection(struct vm_area_struct *vma, | ||
41 | unsigned long address, unsigned long end, pgprot_t newprot); | ||
44 | 42 | ||
45 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE | 43 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE |
46 | #define is_hugepage_only_range(mm, addr, len) 0 | 44 | #define is_hugepage_only_range(mm, addr, len) 0 |
47 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ | 45 | #endif |
48 | do { } while (0) | 46 | |
47 | #ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE | ||
48 | #define hugetlb_free_pgd_range free_pgd_range | ||
49 | #else | ||
50 | void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | ||
51 | unsigned long end, unsigned long floor, | ||
52 | unsigned long ceiling); | ||
49 | #endif | 53 | #endif |
50 | 54 | ||
51 | #ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE | 55 | #ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE |
52 | #define prepare_hugepage_range(addr, len) \ | 56 | /* |
53 | is_aligned_hugepage_range(addr, len) | 57 | * If the arch doesn't supply something else, assume that hugepage |
58 | * size aligned regions are ok without further preparation. | ||
59 | */ | ||
60 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
61 | { | ||
62 | if (len & ~HPAGE_MASK) | ||
63 | return -EINVAL; | ||
64 | if (addr & ~HPAGE_MASK) | ||
65 | return -EINVAL; | ||
66 | return 0; | ||
67 | } | ||
54 | #else | 68 | #else |
55 | int prepare_hugepage_range(unsigned long addr, unsigned long len); | 69 | int prepare_hugepage_range(unsigned long addr, unsigned long len); |
56 | #endif | 70 | #endif |
@@ -87,20 +101,17 @@ static inline unsigned long hugetlb_total_pages(void) | |||
87 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 101 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
88 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 102 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
89 | #define unmap_hugepage_range(vma, start, end) BUG() | 103 | #define unmap_hugepage_range(vma, start, end) BUG() |
90 | #define is_hugepage_mem_enough(size) 0 | ||
91 | #define hugetlb_report_meminfo(buf) 0 | 104 | #define hugetlb_report_meminfo(buf) 0 |
92 | #define hugetlb_report_node_meminfo(n, buf) 0 | 105 | #define hugetlb_report_node_meminfo(n, buf) 0 |
93 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 106 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
94 | #define is_aligned_hugepage_range(addr, len) 0 | ||
95 | #define prepare_hugepage_range(addr, len) (-EINVAL) | 107 | #define prepare_hugepage_range(addr, len) (-EINVAL) |
96 | #define pmd_huge(x) 0 | 108 | #define pmd_huge(x) 0 |
97 | #define is_hugepage_only_range(mm, addr, len) 0 | 109 | #define is_hugepage_only_range(mm, addr, len) 0 |
98 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ | 110 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) |
99 | do { } while (0) | ||
100 | #define alloc_huge_page(vma, addr) ({ NULL; }) | ||
101 | #define free_huge_page(p) ({ (void)(p); BUG(); }) | ||
102 | #define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) | 111 | #define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) |
103 | 112 | ||
113 | #define hugetlb_change_protection(vma, address, end, newprot) | ||
114 | |||
104 | #ifndef HPAGE_MASK | 115 | #ifndef HPAGE_MASK |
105 | #define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */ | 116 | #define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */ |
106 | #define HPAGE_SIZE PAGE_SIZE | 117 | #define HPAGE_SIZE PAGE_SIZE |
@@ -128,6 +139,8 @@ struct hugetlbfs_sb_info { | |||
128 | 139 | ||
129 | struct hugetlbfs_inode_info { | 140 | struct hugetlbfs_inode_info { |
130 | struct shared_policy policy; | 141 | struct shared_policy policy; |
142 | /* Protected by the (global) hugetlb_lock */ | ||
143 | unsigned long prereserved_hpages; | ||
131 | struct inode vfs_inode; | 144 | struct inode vfs_inode; |
132 | }; | 145 | }; |
133 | 146 | ||
@@ -144,6 +157,10 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
144 | extern struct file_operations hugetlbfs_file_operations; | 157 | extern struct file_operations hugetlbfs_file_operations; |
145 | extern struct vm_operations_struct hugetlb_vm_ops; | 158 | extern struct vm_operations_struct hugetlb_vm_ops; |
146 | struct file *hugetlb_zero_setup(size_t); | 159 | struct file *hugetlb_zero_setup(size_t); |
160 | int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info, | ||
161 | unsigned long atleast_hpages); | ||
162 | void hugetlb_truncate_reservation(struct hugetlbfs_inode_info *info, | ||
163 | unsigned long atmost_hpages); | ||
147 | int hugetlb_get_quota(struct address_space *mapping); | 164 | int hugetlb_get_quota(struct address_space *mapping); |
148 | void hugetlb_put_quota(struct address_space *mapping); | 165 | void hugetlb_put_quota(struct address_space *mapping); |
149 | 166 | ||