Commit b002a7b0 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

mm: convert migrate_vma_collect_pmd to use a folio

Convert the pmd directly to a folio and use it.  Turns four calls to
compound_head() into one.

Link: https://lkml.kernel.org/r/20240326202833.523759-5-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e06d03d5
...@@ -71,7 +71,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, ...@@ -71,7 +71,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
return migrate_vma_collect_hole(start, end, -1, walk); return migrate_vma_collect_hole(start, end, -1, walk);
if (pmd_trans_huge(*pmdp)) { if (pmd_trans_huge(*pmdp)) {
struct page *page; struct folio *folio;
ptl = pmd_lock(mm, pmdp); ptl = pmd_lock(mm, pmdp);
if (unlikely(!pmd_trans_huge(*pmdp))) { if (unlikely(!pmd_trans_huge(*pmdp))) {
...@@ -79,21 +79,21 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, ...@@ -79,21 +79,21 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
goto again; goto again;
} }
page = pmd_page(*pmdp); folio = pmd_folio(*pmdp);
if (is_huge_zero_page(page)) { if (is_huge_zero_folio(folio)) {
spin_unlock(ptl); spin_unlock(ptl);
split_huge_pmd(vma, pmdp, addr); split_huge_pmd(vma, pmdp, addr);
} else { } else {
int ret; int ret;
get_page(page); folio_get(folio);
spin_unlock(ptl); spin_unlock(ptl);
if (unlikely(!trylock_page(page))) if (unlikely(!folio_trylock(folio)))
return migrate_vma_collect_skip(start, end, return migrate_vma_collect_skip(start, end,
walk); walk);
ret = split_huge_page(page); ret = split_folio(folio);
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
if (ret) if (ret)
return migrate_vma_collect_skip(start, end, return migrate_vma_collect_skip(start, end,
walk); walk);
......
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