diff options
Diffstat (limited to 'include/linux/hugetlb.h')
| -rw-r--r-- | include/linux/hugetlb.h | 88 |
1 files changed, 83 insertions, 5 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index abbc187193a1..ad2271e11f9b 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <linux/mempolicy.h> | 8 | #include <linux/mempolicy.h> |
| 9 | #include <linux/shm.h> | 9 | #include <linux/shm.h> |
| 10 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
| 11 | #include <asm/hugetlb.h> | ||
| 12 | 11 | ||
| 13 | struct ctl_table; | 12 | struct ctl_table; |
| 14 | 13 | ||
| @@ -45,7 +44,8 @@ extern int sysctl_hugetlb_shm_group; | |||
| 45 | 44 | ||
| 46 | /* arch callbacks */ | 45 | /* arch callbacks */ |
| 47 | 46 | ||
| 48 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); | 47 | pte_t *huge_pte_alloc(struct mm_struct *mm, |
| 48 | unsigned long addr, unsigned long sz); | ||
| 49 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); | 49 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); |
| 50 | int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); | 50 | int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); |
| 51 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | 51 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, |
| @@ -80,7 +80,7 @@ static inline unsigned long hugetlb_total_pages(void) | |||
| 80 | #define hugetlb_report_meminfo(buf) 0 | 80 | #define hugetlb_report_meminfo(buf) 0 |
| 81 | #define hugetlb_report_node_meminfo(n, buf) 0 | 81 | #define hugetlb_report_node_meminfo(n, buf) 0 |
| 82 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 82 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
| 83 | #define prepare_hugepage_range(addr,len) (-EINVAL) | 83 | #define prepare_hugepage_range(file, addr, len) (-EINVAL) |
| 84 | #define pmd_huge(x) 0 | 84 | #define pmd_huge(x) 0 |
| 85 | #define is_hugepage_only_range(mm, addr, len) 0 | 85 | #define is_hugepage_only_range(mm, addr, len) 0 |
| 86 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | 86 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) |
| @@ -134,8 +134,6 @@ struct file *hugetlb_file_setup(const char *name, size_t); | |||
| 134 | int hugetlb_get_quota(struct address_space *mapping, long delta); | 134 | int hugetlb_get_quota(struct address_space *mapping, long delta); |
| 135 | void hugetlb_put_quota(struct address_space *mapping, long delta); | 135 | void hugetlb_put_quota(struct address_space *mapping, long delta); |
| 136 | 136 | ||
| 137 | #define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512) | ||
| 138 | |||
| 139 | static inline int is_file_hugepages(struct file *file) | 137 | static inline int is_file_hugepages(struct file *file) |
| 140 | { | 138 | { |
| 141 | if (file->f_op == &hugetlbfs_file_operations) | 139 | if (file->f_op == &hugetlbfs_file_operations) |
| @@ -164,4 +162,84 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
| 164 | unsigned long flags); | 162 | unsigned long flags); |
| 165 | #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ | 163 | #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */ |
| 166 | 164 | ||
| 165 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 166 | |||
| 167 | /* Defines one hugetlb page size */ | ||
| 168 | struct hstate { | ||
| 169 | int hugetlb_next_nid; | ||
| 170 | unsigned int order; | ||
| 171 | unsigned long mask; | ||
| 172 | unsigned long max_huge_pages; | ||
| 173 | unsigned long nr_huge_pages; | ||
| 174 | unsigned long free_huge_pages; | ||
| 175 | unsigned long resv_huge_pages; | ||
| 176 | unsigned long surplus_huge_pages; | ||
| 177 | unsigned long nr_overcommit_huge_pages; | ||
| 178 | struct list_head hugepage_freelists[MAX_NUMNODES]; | ||
| 179 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; | ||
| 180 | unsigned int free_huge_pages_node[MAX_NUMNODES]; | ||
| 181 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; | ||
| 182 | }; | ||
| 183 | |||
| 184 | extern struct hstate default_hstate; | ||
| 185 | |||
| 186 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | ||
| 187 | { | ||
| 188 | return &default_hstate; | ||
| 189 | } | ||
| 190 | |||
| 191 | static inline struct hstate *hstate_file(struct file *f) | ||
| 192 | { | ||
| 193 | return &default_hstate; | ||
| 194 | } | ||
| 195 | |||
| 196 | static inline struct hstate *hstate_inode(struct inode *i) | ||
| 197 | { | ||
| 198 | return &default_hstate; | ||
| 199 | } | ||
| 200 | |||
| 201 | static inline unsigned long huge_page_size(struct hstate *h) | ||
| 202 | { | ||
| 203 | return (unsigned long)PAGE_SIZE << h->order; | ||
| 204 | } | ||
| 205 | |||
| 206 | static inline unsigned long huge_page_mask(struct hstate *h) | ||
| 207 | { | ||
| 208 | return h->mask; | ||
| 209 | } | ||
| 210 | |||
| 211 | static inline unsigned int huge_page_order(struct hstate *h) | ||
| 212 | { | ||
| 213 | return h->order; | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline unsigned huge_page_shift(struct hstate *h) | ||
| 217 | { | ||
| 218 | return h->order + PAGE_SHIFT; | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline unsigned int pages_per_huge_page(struct hstate *h) | ||
| 222 | { | ||
| 223 | return 1 << h->order; | ||
| 224 | } | ||
| 225 | |||
| 226 | static inline unsigned int blocks_per_huge_page(struct hstate *h) | ||
| 227 | { | ||
| 228 | return huge_page_size(h) / 512; | ||
| 229 | } | ||
| 230 | |||
| 231 | #include <asm/hugetlb.h> | ||
| 232 | |||
| 233 | #else | ||
| 234 | struct hstate {}; | ||
| 235 | #define hstate_file(f) NULL | ||
| 236 | #define hstate_vma(v) NULL | ||
| 237 | #define hstate_inode(i) NULL | ||
| 238 | #define huge_page_size(h) PAGE_SIZE | ||
| 239 | #define huge_page_mask(h) PAGE_MASK | ||
| 240 | #define huge_page_order(h) 0 | ||
| 241 | #define huge_page_shift(h) PAGE_SHIFT | ||
| 242 | #define pages_per_huge_page(h) 1 | ||
| 243 | #endif | ||
| 244 | |||
| 167 | #endif /* _LINUX_HUGETLB_H */ | 245 | #endif /* _LINUX_HUGETLB_H */ |
