This is like compound_head() but compiles away when CONFIG_TRANSPARENT_HUGEPAGE is not enabled.
Unified · Split
| @@ -259,6 +259,15 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, · 258 unmodified lines | |||
| 259 | return NULL; | 259 | return NULL; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | /** | ||
| 263 | * thp_head - Head page of a transparent huge page. | ||
| 264 | * @page: Any page (tail, head or regular) found in the page cache. | ||
| 265 | */ | ||
| 266 | static inline struct page *thp_head(struct page *page) | ||
| 267 | { | ||
| 268 | return compound_head(page); | ||
| 269 | } | ||
| 270 | |||
| 262 | /** | 271 | /** |
| 263 | * thp_order - Order of a transparent huge page. | 272 | * thp_order - Order of a transparent huge page. |
| 264 | * @page: Head page of a transparent huge page. | 273 | * @page: Head page of a transparent huge page. |
| @@ -335,6 +344,12 @@ static inline struct list_head *page_deferred_list(struct page *page) · 70 unmodified lines | |||
| 335 | #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) | 344 | #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) |
| 336 | #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) | 345 | #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) |
| 337 | 346 | ||
| 347 | static inline struct page *thp_head(struct page *page) | ||
| 348 | { | ||
| 349 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | ||
| 350 | return page; | ||
| 351 | } | ||
| 352 | |||
| 338 | static inline unsigned int thp_order(struct page *page) | 353 | static inline unsigned int thp_order(struct page *page) |
| 339 | { | 354 | { |
| 340 | VM_BUG_ON_PGFLAGS(PageTail(page), page); | 355 | VM_BUG_ON_PGFLAGS(PageTail(page), page); |