Commit 5ef82fe7 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by akpm

mm/swap: convert __put_compound_page() to __folio_put_large()

All the callers now have a folio, so pass it in.  This doesn't
save any text, but it does save a call to compound_head() as
folio_test_hugetlb() does not contain a call like PageHuge() does.

Link: https://lkml.kernel.org/r/20220617175020.717127-18-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 83d99659
...@@ -106,7 +106,7 @@ static void __folio_put_small(struct folio *folio) ...@@ -106,7 +106,7 @@ static void __folio_put_small(struct folio *folio)
free_unref_page(&folio->page, 0); free_unref_page(&folio->page, 0);
} }
static void __put_compound_page(struct page *page) static void __folio_put_large(struct folio *folio)
{ {
/* /*
* __page_cache_release() is supposed to be called for thp, not for * __page_cache_release() is supposed to be called for thp, not for
...@@ -114,9 +114,9 @@ static void __put_compound_page(struct page *page) ...@@ -114,9 +114,9 @@ static void __put_compound_page(struct page *page)
* (it's never listed to any LRU lists) and no memcg routines should * (it's never listed to any LRU lists) and no memcg routines should
* be called for hugetlb (it has a separate hugetlb_cgroup.) * be called for hugetlb (it has a separate hugetlb_cgroup.)
*/ */
if (!PageHuge(page)) if (!folio_test_hugetlb(folio))
__page_cache_release(page); __page_cache_release(&folio->page);
destroy_compound_page(page); destroy_compound_page(&folio->page);
} }
void __folio_put(struct folio *folio) void __folio_put(struct folio *folio)
...@@ -124,7 +124,7 @@ void __folio_put(struct folio *folio) ...@@ -124,7 +124,7 @@ void __folio_put(struct folio *folio)
if (unlikely(folio_is_zone_device(folio))) if (unlikely(folio_is_zone_device(folio)))
free_zone_device_page(&folio->page); free_zone_device_page(&folio->page);
else if (unlikely(folio_test_large(folio))) else if (unlikely(folio_test_large(folio)))
__put_compound_page(&folio->page); __folio_put_large(folio);
else else
__folio_put_small(folio); __folio_put_small(folio);
} }
...@@ -147,7 +147,7 @@ void put_pages_list(struct list_head *pages) ...@@ -147,7 +147,7 @@ void put_pages_list(struct list_head *pages)
} }
if (folio_test_large(folio)) { if (folio_test_large(folio)) {
list_del(&folio->lru); list_del(&folio->lru);
__put_compound_page(&folio->page); __folio_put_large(folio);
continue; continue;
} }
/* LRU flag must be clear because it's passed using the lru */ /* LRU flag must be clear because it's passed using the lru */
...@@ -976,7 +976,7 @@ void release_pages(struct page **pages, int nr) ...@@ -976,7 +976,7 @@ void release_pages(struct page **pages, int nr)
unlock_page_lruvec_irqrestore(lruvec, flags); unlock_page_lruvec_irqrestore(lruvec, flags);
lruvec = NULL; lruvec = NULL;
} }
__put_compound_page(&folio->page); __folio_put_large(folio);
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment