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 | 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 | 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 | 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 | 103 | static void __put_compound_page(struct page *page) |
| 104 | 104 | { |
| 105 | − compound_page_dtor *dtor; | |
| 106 | − | |
| 107 | 105 | /* |
| 108 | 106 | * __page_cache_release() is supposed to be called for thp, not for |
| 109 | 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 | 111 | if (!PageHuge(page)) |
| 114 | 112 | __page_cache_release(page); |
| 115 | − dtor = get_compound_page_dtor(page); | |
| 116 | − (*dtor)(page); | |
| 113 | + destroy_compound_page(page); | |
| 117 | 114 | } |
| 118 | 115 | |
| 119 | 116 | void __put_page(struct page *page) |
| @@ -1438,7 +1438,7 @@ free_it: · 1437 unmodified lines | ||
| 1438 | 1438 | * appear not as the counts should be low |
| 1439 | 1439 | */ |
| 1440 | 1440 | if (unlikely(PageTransHuge(page))) |
| 1441 | − (*get_compound_page_dtor(page))(page); | |
| 1441 | + destroy_compound_page(page); | |
| 1442 | 1442 | else |
| 1443 | 1443 | list_add(&page->lru, &free_pages); |
| 1444 | 1444 | continue; |
| @@ -1859,7 +1859,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, · 414 unmodified lines | ||
| 1859 | 1859 | |
| 1860 | 1860 | if (unlikely(PageCompound(page))) { |
| 1861 | 1861 | spin_unlock_irq(&pgdat->lru_lock); |
| 1862 | − (*get_compound_page_dtor(page))(page); | |
| 1862 | + destroy_compound_page(page); | |
| 1863 | 1863 | spin_lock_irq(&pgdat->lru_lock); |
| 1864 | 1864 | } else |
| 1865 | 1865 | list_add(&page->lru, &pages_to_free); |