History

include/linux/pagemap.h: optimise find_subpage for !THP

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.

Matthew Wilcox (Oracle) committed 6 years ago

Commit a0650601 parent 85b9f461 file · +1 −3Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/pagemap.h+1−3
@@ -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
349struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);347struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);