History

mm: Turn head_compound_mapcount() into folio_entire_mapcount()

Adjust documentation to be more clear.

Matthew Wilcox (Oracle) committed 4 years ago

Commit 74e8ee41 parent e20c41b2 files · +15 −8Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/mm.h+11−6
@@ -776,21 +776,26 @@ static inline int is_vmalloc_or_module_addr(const void *x) · 775 unmodified lines
776}776}
777#endif777#endif
778 778
779static inline int head_compound_mapcount(struct page *head)779/*
780 * How many times the entire folio is mapped as a single unit (eg by a
781 * PMD or PUD entry). This is probably not what you want, except for
782 * debugging purposes; look at folio_mapcount() or page_mapcount()
783 * instead.
784 */
785static inline int folio_entire_mapcount(struct folio *folio)
780{786{
781 return atomic_read(compound_mapcount_ptr(head)) + 1;787 VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
788 return atomic_read(folio_mapcount_ptr(folio)) + 1;
782}789}
783 790
784/*791/*
785 * Mapcount of compound page as a whole, does not include mapped sub-pages.792 * Mapcount of compound page as a whole, does not include mapped sub-pages.
786 *793 *
787 * Must be called only for compound pages or any their tail sub-pages.794 * Must be called only for compound pages.
788 */795 */
789static inline int compound_mapcount(struct page *page)796static inline int compound_mapcount(struct page *page)
790{797{
791 VM_BUG_ON_PAGE(!PageCompound(page), page);798 return folio_entire_mapcount(page_folio(page));
792 page = compound_head(page);
793 return head_compound_mapcount(page);
794}799}
795 800
796/*801/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t