diff options
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r-- | include/linux/hugetlb.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 6b4890fa57e7..feaf0c7fb7d8 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -358,6 +358,17 @@ static inline int hstate_index(struct hstate *h) | |||
358 | return h - hstates; | 358 | return h - hstates; |
359 | } | 359 | } |
360 | 360 | ||
361 | pgoff_t __basepage_index(struct page *page); | ||
362 | |||
363 | /* Return page->index in PAGE_SIZE units */ | ||
364 | static inline pgoff_t basepage_index(struct page *page) | ||
365 | { | ||
366 | if (!PageCompound(page)) | ||
367 | return page->index; | ||
368 | |||
369 | return __basepage_index(page); | ||
370 | } | ||
371 | |||
361 | #else /* CONFIG_HUGETLB_PAGE */ | 372 | #else /* CONFIG_HUGETLB_PAGE */ |
362 | struct hstate {}; | 373 | struct hstate {}; |
363 | #define alloc_huge_page_node(h, nid) NULL | 374 | #define alloc_huge_page_node(h, nid) NULL |
@@ -378,6 +389,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) | |||
378 | } | 389 | } |
379 | #define hstate_index_to_shift(index) 0 | 390 | #define hstate_index_to_shift(index) 0 |
380 | #define hstate_index(h) 0 | 391 | #define hstate_index(h) 0 |
392 | |||
393 | static inline pgoff_t basepage_index(struct page *page) | ||
394 | { | ||
395 | return page->index; | ||
396 | } | ||
381 | #endif /* CONFIG_HUGETLB_PAGE */ | 397 | #endif /* CONFIG_HUGETLB_PAGE */ |
382 | 398 | ||
383 | #endif /* _LINUX_HUGETLB_H */ | 399 | #endif /* _LINUX_HUGETLB_H */ |