|
@@ -358,6 +358,17 @@ static inline int hstate_index(struct hstate *h)
|
|
|
return h - hstates;
|
|
|
}
|
|
|
|
|
|
+pgoff_t __basepage_index(struct page *page);
|
|
|
+
|
|
|
+/* Return page->index in PAGE_SIZE units */
|
|
|
+static inline pgoff_t basepage_index(struct page *page)
|
|
|
+{
|
|
|
+ if (!PageCompound(page))
|
|
|
+ return page->index;
|
|
|
+
|
|
|
+ return __basepage_index(page);
|
|
|
+}
|
|
|
+
|
|
|
#else /* CONFIG_HUGETLB_PAGE */
|
|
|
struct hstate {};
|
|
|
#define alloc_huge_page_node(h, nid) NULL
|
|
@@ -378,6 +389,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
|
|
|
}
|
|
|
#define hstate_index_to_shift(index) 0
|
|
|
#define hstate_index(h) 0
|
|
|
+
|
|
|
+static inline pgoff_t basepage_index(struct page *page)
|
|
|
+{
|
|
|
+ return page->index;
|
|
|
+}
|
|
|
#endif /* CONFIG_HUGETLB_PAGE */
|
|
|
|
|
|
#endif /* _LINUX_HUGETLB_H */
|