If THP is disabled, find_subpage() can become a no-op by using hpage_nr_pages() instead of compound_nr(). hpage_nr_pages() embeds a check for PageTail, so we can drop the check here.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -341,9 +341,7 @@ static inline struct page *find_subpage(struct page *head, pgoff_t index) · 340 unmodified lines | |||
| 341 | if (PageHuge(head)) | 341 | if (PageHuge(head)) |
| 342 | return head; | 342 | return head; |
| 343 | 343 | ||
| 344 | VM_BUG_ON_PAGE(PageTail(head), head); | 344 | return head + (index & (hpage_nr_pages(head) - 1)); |
| 345 | |||
| 346 | return head + (index & (compound_nr(head) - 1)); | ||
| 347 | } | 345 | } |
| 348 | 346 | ||
| 349 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); | 347 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); |