Adjust documentation to be more clear.
Unified · Split
| @@ -776,21 +776,26 @@ static inline int is_vmalloc_or_module_addr(const void *x) · 775 unmodified lines | ||
| 776 | 776 | } |
| 777 | 777 | #endif |
| 778 | 778 | |
| 779 | −static 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 | + */ | |
| 785 | +static 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 | 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 | */ |
| 789 | 796 | static inline int compound_mapcount(struct page *page) |
| 790 | 797 | { |
| 791 | − VM_BUG_ON_PAGE(!PageCompound(page), page); | |
| 792 | − page = compound_head(page); | |
| 793 | − return head_compound_mapcount(page); | |
| 798 | + return folio_entire_mapcount(page_folio(page)); | |
| 794 | 799 | } |
| 795 | 800 | |
| 796 | 801 | /* |
| @@ -48,7 +48,8 @@ const struct trace_print_flags vmaflag_names[] = { · 47 unmodified lines | ||
| 48 | 48 | |
| 49 | 49 | static void __dump_page(struct page *page) |
| 50 | 50 | { |
| 51 | − struct page *head = compound_head(page); | |
| 51 | + struct folio *folio = page_folio(page); | |
| 52 | + struct page *head = &folio->page; | |
| 52 | 53 | struct address_space *mapping; |
| 53 | 54 | bool compound = PageCompound(page); |
| 54 | 55 | /* |
| @@ -76,6 +77,7 @@ static void __dump_page(struct page *page) · 21 unmodified lines | ||
| 76 | 77 | else |
| 77 | 78 | mapping = (void *)(tmp & ~PAGE_MAPPING_FLAGS); |
| 78 | 79 | head = page; |
| 80 | + folio = (struct folio *)page; | |
| 79 | 81 | compound = false; |
| 80 | 82 | } else { |
| 81 | 83 | mapping = page_mapping(page); |
| @@ -94,7 +96,7 @@ static void __dump_page(struct page *page) · 12 unmodified lines | ||
| 94 | 96 | if (compound) { |
| 95 | 97 | pr_warn("head:%p order:%u compound_mapcount:%d compound_pincount:%d\n", |
| 96 | 98 | head, compound_order(head), |
| 97 | − head_compound_mapcount(head), | |
| 99 | + folio_entire_mapcount(folio), | |
| 98 | 100 | head_compound_pincount(head)); |
| 99 | 101 | } |
| 100 | 102 | |