struct hugepage_subpool *hugepage_new_subpool(long nr_blocks);
void hugepage_put_subpool(struct hugepage_subpool *spool);
-int PageHuge(struct page *page);
-
void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
#else /* !CONFIG_HUGETLB_PAGE */
-static inline int PageHuge(struct page *page)
-{
- return 0;
-}
-
static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
{
}
return !!(vma->vm_flags & VM_HUGETLB);
}
+int PageHuge(struct page *page);
+unsigned int huge_page_size_order(struct page *page);
+
#else
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
return 0;
}
+static inline int PageHuge(struct page *page)
+{
+ return 0;
+}
+
+static inline unsigned int huge_page_size_order(struct page *page)
+{
+ return 0;
+}
+
#endif
#endif
return ((loff_t)page_file_index(page)) << PAGE_CACHE_SHIFT;
}
-extern pgoff_t hugepage_pgoff(struct page *page);
+static inline unsigned int page_size_order(struct page *page)
+{
+ return unlikely(PageHuge(page)) ?
+ huge_page_size_order(page) :
+ (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+}
/*
* page->index stores pagecache index whose unit is not always PAGE_SIZE.
* This function converts it into PAGE_SIZE offset.
*/
-#define page_pgoff(page) \
-({ \
- unlikely(PageHuge(page)) ? \
- hugepage_pgoff(page) : \
- page->index >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); \
-})
+static inline pgoff_t page_pgoff(struct page *page)
+{
+ return page->index << page_size_order(page);
+}
extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,
unsigned long address);
#include <linux/io.h>
#include <linux/hugetlb.h>
+#include <linux/hugetlb_inline.h>
#include <linux/hugetlb_cgroup.h>
#include <linux/node.h>
#include "internal.h"
return (index << compound_order(page_head)) + compound_idx;
}
-pgoff_t hugepage_pgoff(struct page *page)
+unsigned int huge_page_size_order(struct page *page)
{
- return page->index << huge_page_order(page_hstate(page));
+ return huge_page_order(page_hstate(page));
}
static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)