summaryrefslogtreecommitdiff
path: root/mm/gup.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2021-12-23 02:07:47 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 19:56:36 +0300
commit83afb52e47d5e31c7d58c07a6d31c43b5ef421a0 (patch)
treeb5a9020cab28452ee8f633a263ce5c3bc769e96c /mm/gup.c
parent667ed1f7bb3b1c1ec2512e64cec04a07df7c5068 (diff)
downloadlinux-83afb52e47d5e31c7d58c07a6d31c43b5ef421a0.tar.xz
mm/gup: Convert gup_huge_pud() to use a folio
Use the new folio-based APIs. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'mm/gup.c')
-rw-r--r--mm/gup.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mm/gup.c b/mm/gup.c
index 15de59333c3d..b6ca2364af8a 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2524,7 +2524,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
unsigned long end, unsigned int flags,
struct page **pages, int *nr)
{
- struct page *head, *page;
+ struct page *page;
+ struct folio *folio;
int refs;
if (!pud_access_permitted(orig, flags & FOLL_WRITE))
@@ -2540,17 +2541,17 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
page = nth_page(pud_page(orig), (addr & ~PUD_MASK) >> PAGE_SHIFT);
refs = record_subpages(page, addr, end, pages + *nr);
- head = try_grab_compound_head(pud_page(orig), refs, flags);
- if (!head)
+ folio = try_grab_folio(page, refs, flags);
+ if (!folio)
return 0;
if (unlikely(pud_val(orig) != pud_val(*pudp))) {
- put_compound_head(head, refs, flags);
+ gup_put_folio(folio, refs, flags);
return 0;
}
*nr += refs;
- SetPageReferenced(head);
+ folio_set_referenced(folio);
return 1;
}