Skip to content

Commit b54d60b

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm/khugepaged: use a folio more in collapse_file()
This function is not yet fully converted to the folio API, but this removes a few uses of old APIs. Link: https://lkml.kernel.org/r/20231228085748.1083901-6-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 82feeaa commit b54d60b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

mm/khugepaged.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,23 +2122,23 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
21222122
xas_lock_irq(&xas);
21232123
}
21242124

2125-
nr = thp_nr_pages(hpage);
2125+
folio = page_folio(hpage);
2126+
nr = folio_nr_pages(folio);
21262127
if (is_shmem)
2127-
__mod_lruvec_page_state(hpage, NR_SHMEM_THPS, nr);
2128+
__lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr);
21282129
else
2129-
__mod_lruvec_page_state(hpage, NR_FILE_THPS, nr);
2130+
__lruvec_stat_mod_folio(folio, NR_FILE_THPS, nr);
21302131

21312132
if (nr_none) {
2132-
__mod_lruvec_page_state(hpage, NR_FILE_PAGES, nr_none);
2133+
__lruvec_stat_mod_folio(folio, NR_FILE_PAGES, nr_none);
21332134
/* nr_none is always 0 for non-shmem. */
2134-
__mod_lruvec_page_state(hpage, NR_SHMEM, nr_none);
2135+
__lruvec_stat_mod_folio(folio, NR_SHMEM, nr_none);
21352136
}
21362137

21372138
/*
21382139
* Mark hpage as uptodate before inserting it into the page cache so
21392140
* that it isn't mistaken for an fallocated but unwritten page.
21402141
*/
2141-
folio = page_folio(hpage);
21422142
folio_mark_uptodate(folio);
21432143
folio_ref_add(folio, HPAGE_PMD_NR - 1);
21442144

@@ -2148,7 +2148,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
21482148

21492149
/* Join all the small entries into a single multi-index entry. */
21502150
xas_set_order(&xas, start, HPAGE_PMD_ORDER);
2151-
xas_store(&xas, hpage);
2151+
xas_store(&xas, folio);
21522152
WARN_ON_ONCE(xas_error(&xas));
21532153
xas_unlock_irq(&xas);
21542154

@@ -2159,7 +2159,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
21592159
retract_page_tables(mapping, start);
21602160
if (cc && !cc->is_khugepaged)
21612161
result = SCAN_PTE_MAPPED_HUGEPAGE;
2162-
unlock_page(hpage);
2162+
folio_unlock(folio);
21632163

21642164
/*
21652165
* The collapse has succeeded, so free the old pages.

0 commit comments

Comments
 (0)