Skip to content

Commit 346cf61

Browse files
author
Matthew Wilcox (Oracle)
committed
mm: Add split_folio_to_list()
This is a convenience function; split_huge_page_to_list() can take any page in a folio (and does so on purpose because that page will be the one which keeps the refcount). But it's convenient for the callers to pass the folio instead of the first page in the folio. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 4ba1119 commit 346cf61

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

include/linux/huge_mm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@ static inline bool thp_migration_supported(void)
483483
}
484484
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
485485

486+
static inline int split_folio_to_list(struct folio *folio,
487+
struct list_head *list)
488+
{
489+
return split_huge_page_to_list(&folio->page, list);
490+
}
491+
486492
/**
487493
* thp_size - Size of a transparent huge page.
488494
* @page: Head page of a transparent huge page.

mm/vmscan.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,16 +1715,16 @@ static unsigned int shrink_page_list(struct list_head *page_list,
17151715
* tail pages can be freed without IO.
17161716
*/
17171717
if (!compound_mapcount(page) &&
1718-
split_huge_page_to_list(page,
1719-
page_list))
1718+
split_folio_to_list(folio,
1719+
page_list))
17201720
goto activate_locked;
17211721
}
17221722
if (!add_to_swap(page)) {
17231723
if (!PageTransHuge(page))
17241724
goto activate_locked_split;
17251725
/* Fallback to swap normal pages */
1726-
if (split_huge_page_to_list(page,
1727-
page_list))
1726+
if (split_folio_to_list(folio,
1727+
page_list))
17281728
goto activate_locked;
17291729
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
17301730
count_vm_event(THP_SWPOUT_FALLBACK);
@@ -1740,7 +1740,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
17401740
}
17411741
} else if (unlikely(PageTransHuge(page))) {
17421742
/* Split file THP */
1743-
if (split_huge_page_to_list(page, page_list))
1743+
if (split_folio_to_list(folio, page_list))
17441744
goto keep_locked;
17451745
}
17461746

0 commit comments

Comments
 (0)