Replaces some calls with their folio equivalents. This is in preparation for the removal of lru_cache_add(). This replaces 3 calls to compound_head() with 1. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx> --- mm/khugepaged.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4734315f7940..e432d5279043 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1970,6 +1970,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, if (result == SCAN_SUCCEED) { struct page *page, *tmp; + struct folio *folio; /* * Replacing old pages with new one has succeeded, now we @@ -1997,11 +1998,13 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, index++; } - SetPageUptodate(hpage); - page_ref_add(hpage, HPAGE_PMD_NR - 1); + folio = page_folio(hpage); + folio_mark_uptodate(folio); + folio_ref_add(folio, HPAGE_PMD_NR - 1); + if (is_shmem) - set_page_dirty(hpage); - lru_cache_add(hpage); + folio_mark_dirty(folio); + folio_add_lru(folio); /* * Remove pte page tables, so we can re-fault the page as huge. -- 2.38.1