None of the three callers of get_compound_page_dtor() want to know the value; they just want to call the function. Replace it with destroy_compound_page() which calls the dtor for them.
Unified · Split
| @@ -876,10 +876,10 @@ static inline void set_compound_page_dtor(struct page *page, · 875 unmodified lines | |||
| 876 | page[1].compound_dtor = compound_dtor; | 876 | page[1].compound_dtor = compound_dtor; |
| 877 | } | 877 | } |
| 878 | 878 | ||
| 879 | static inline compound_page_dtor *get_compound_page_dtor(struct page *page) | 879 | static inline void destroy_compound_page(struct page *page) |
| 880 | { | 880 | { |
| 881 | VM_BUG_ON_PAGE(page[1].compound_dtor >= NR_COMPOUND_DTORS, page); | 881 | VM_BUG_ON_PAGE(page[1].compound_dtor >= NR_COMPOUND_DTORS, page); |
| 882 | return compound_page_dtors[page[1].compound_dtor]; | 882 | compound_page_dtors[page[1].compound_dtor](page); |
| 883 | } | 883 | } |
| 884 | 884 | ||
| 885 | static inline unsigned int compound_order(struct page *page) | 885 | static inline unsigned int compound_order(struct page *page) |
| @@ -102,8 +102,6 @@ static void __put_single_page(struct page *page) · 101 unmodified lines | |||
| 102 | 102 | ||
| 103 | static void __put_compound_page(struct page *page) | 103 | static void __put_compound_page(struct page *page) |
| 104 | { | 104 | { |
| 105 | compound_page_dtor *dtor; | ||
| 106 | |||
| 107 | /* | 105 | /* |
| 108 | * __page_cache_release() is supposed to be called for thp, not for | 106 | * __page_cache_release() is supposed to be called for thp, not for |
| 109 | * hugetlb. This is because hugetlb page does never have PageLRU set | 107 | * hugetlb. This is because hugetlb page does never have PageLRU set |
| @@ -112,8 +110,7 @@ static void __put_compound_page(struct page *page) · 2 unmodified lines | |||
| 112 | */ | 110 | */ |
| 113 | if (!PageHuge(page)) | 111 | if (!PageHuge(page)) |
| 114 | __page_cache_release(page); | 112 | __page_cache_release(page); |
| 115 | dtor = get_compound_page_dtor(page); | 113 | destroy_compound_page(page); |
| 116 | (*dtor)(page); | ||
| 117 | } | 114 | } |
| 118 | 115 | ||
| 119 | void __put_page(struct page *page) | 116 | void __put_page(struct page *page) |
| @@ -1438,7 +1438,7 @@ free_it: · 1437 unmodified lines | |||
| 1438 | * appear not as the counts should be low | 1438 | * appear not as the counts should be low |
| 1439 | */ | 1439 | */ |
| 1440 | if (unlikely(PageTransHuge(page))) | 1440 | if (unlikely(PageTransHuge(page))) |
| 1441 | (*get_compound_page_dtor(page))(page); | 1441 | destroy_compound_page(page); |
| 1442 | else | 1442 | else |
| 1443 | list_add(&page->lru, &free_pages); | 1443 | list_add(&page->lru, &free_pages); |
| 1444 | continue; | 1444 | continue; |
| @@ -1859,7 +1859,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, · 414 unmodified lines | |||
| 1859 | 1859 | ||
| 1860 | if (unlikely(PageCompound(page))) { | 1860 | if (unlikely(PageCompound(page))) { |
| 1861 | spin_unlock_irq(&pgdat->lru_lock); | 1861 | spin_unlock_irq(&pgdat->lru_lock); |
| 1862 | (*get_compound_page_dtor(page))(page); | 1862 | destroy_compound_page(page); |
| 1863 | spin_lock_irq(&pgdat->lru_lock); | 1863 | spin_lock_irq(&pgdat->lru_lock); |
| 1864 | } else | 1864 | } else |
| 1865 | list_add(&page->lru, &pages_to_free); | 1865 | list_add(&page->lru, &pages_to_free); |