mm: Simplify calling a compound page destructor
Subsystems (4)
PATCH 1/1 mm: Simplify calling a compound page destructor
From: "Matthew Wilcox (Oracle)" <[email protected]>
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.
--- include/linux/mm.h | 4 ++-- mm/swap.c | 5 +---- mm/vmscan.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-)
include/linux/mm.h +2 -2
@@ -865,10 +865,10 @@ static inline void set_compound_page_dtor(struct page *page, page[1 ].compound_dtor = compound_dtor; } -static inline compound_page_dtor *get_compound_page_dtor (struct page *page) +static inline void destroy_compound_page (struct page *page) {VM_BUG_ON_PAGE (page[1 ].compound_dtor >=NR_COMPOUND_DTORS , page); -return compound_page_dtors[page[1 ].compound_dtor]; + compound_page_dtors[page[1 ].compound_dtor](page); }static inline unsigned int compound_order (struct page *page)
mm/swap.c +1 -4
@@ -83,8 +83,6 @@ static void __put_single_page(struct page *page)static void __put_compound_page (struct page *page) { -compound_page_dtor *dtor; -/* * __page_cache_release() is supposed to be called for thp, not for * hugetlb. This is because hugetlb page does never have PageLRU set
@@ -93,8 +91,7 @@ static void __put_compound_page(struct page *page)*/ if (!PageHuge (page))__page_cache_release (page); - dtor =get_compound_page_dtor (page); - (*dtor)(page); +destroy_compound_page (page); }void __put_page (struct page *page)
mm/vmscan.c +2 -2
@@ -1442,7 +1442,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,* appear not as the counts should be low */ if (unlikely (PageTransHuge (page))) - (*get_compound_page_dtor (page))(page); +destroy_compound_page (page);else list_add (&page->lru, &free_pages);continue ;
@@ -1870,7 +1870,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,if (unlikely (PageCompound (page))) {spin_unlock_irq (&pgdat->lru_lock); - (*get_compound_page_dtor (page))(page); +destroy_compound_page (page);spin_lock_irq (&pgdat->lru_lock); }else list_add (&page->lru, &pages_to_free);
Signature · 1 line
2.26.2
Quoted 7 lines · Matthew Wilcox
From: "Matthew Wilcox (Oracle)" <[email protected]>
None of the three callers of
get_compound_page_dtor()want to know the value; they just want to call the function. Replace it withdestroy_compound_page()which calls the dtor for them.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Makes it simple and clean.
Quoted 7 lines · Matthew Wilcox
From: "Matthew Wilcox (Oracle)" <[email protected]>
None of the three callers of
get_compound_page_dtor()want to know the value; they just want to call the function. Replace it withdestroy_compound_page()which calls the dtor for them.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Signature · 1 line
Kirill A. Shutemov
Quoted 68 lines · Matthew Wilcox
From: "Matthew Wilcox (Oracle)" <[email protected]>
None of the three callers of
get_compound_page_dtor()want to know the value; they just want to call the function. Replace it withdestroy_compound_page()which calls the dtor for them.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- include/linux/mm.h | 4 ++-- mm/swap.c | 5 +---- mm/vmscan.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-)include/linux/mm.h +2
-2@@ -865,10 +865,10 @@ static inline void set_compound_page_dtor(struct page *page, page[1 ].compound_dtor = compound_dtor; } -static inline compound_page_dtor *get_compound_page_dtor (struct page *page) +static inline void destroy_compound_page (struct page *page) {VM_BUG_ON_PAGE (page[1 ].compound_dtor >=NR_COMPOUND_DTORS , page); -return compound_page_dtors[page[1 ].compound_dtor]; + compound_page_dtors[page[1 ].compound_dtor](page); }static inline unsigned int compound_order (struct page *page)mm/swap.c +1
-4@@ -83,8 +83,6 @@ static void __put_single_page(struct page *page)static void __put_compound_page (struct page *page) { -compound_page_dtor *dtor; -/* * __page_cache_release() is supposed to be called for thp, not for * hugetlb. This is because hugetlb page does never have PageLRU set @@ -93,8 +91,7 @@ static void __put_compound_page(struct page *page)*/ if (!PageHuge (page))__page_cache_release (page); - dtor =get_compound_page_dtor (page); - (*dtor)(page); +destroy_compound_page (page); }void __put_page (struct page *page)mm/vmscan.c +1
-1@@ -1442,7 +1442,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,* appear not as the counts should be low */ if (unlikely (PageTransHuge (page))) - (*get_compound_page_dtor (page))(page); +destroy_compound_page (page);else list_add (&page->lru, &free_pages);continue ;
mm/vmscan.c static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, · line 1876
Quoted 8 lines
mm/vmscan.c +1
-1@@ -1870,7 +1870,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,if (unlikely (PageCompound (page))) {spin_unlock_irq (&pgdat->lru_lock); - (*get_compound_page_dtor (page))(page); +destroy_compound_page (page);spin_lock_irq (&pgdat->lru_lock); }else list_add (&page->lru, &pages_to_free);
Signature · 3 lines
Thanks, David / dhildenb