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>
This commit is contained in:
parent
667ed1f7bb
commit
83afb52e47
11
mm/gup.c
11
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,
|
unsigned long end, unsigned int flags,
|
||||||
struct page **pages, int *nr)
|
struct page **pages, int *nr)
|
||||||
{
|
{
|
||||||
struct page *head, *page;
|
struct page *page;
|
||||||
|
struct folio *folio;
|
||||||
int refs;
|
int refs;
|
||||||
|
|
||||||
if (!pud_access_permitted(orig, flags & FOLL_WRITE))
|
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);
|
page = nth_page(pud_page(orig), (addr & ~PUD_MASK) >> PAGE_SHIFT);
|
||||||
refs = record_subpages(page, addr, end, pages + *nr);
|
refs = record_subpages(page, addr, end, pages + *nr);
|
||||||
|
|
||||||
head = try_grab_compound_head(pud_page(orig), refs, flags);
|
folio = try_grab_folio(page, refs, flags);
|
||||||
if (!head)
|
if (!folio)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (unlikely(pud_val(orig) != pud_val(*pudp))) {
|
if (unlikely(pud_val(orig) != pud_val(*pudp))) {
|
||||||
put_compound_head(head, refs, flags);
|
gup_put_folio(folio, refs, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*nr += refs;
|
*nr += refs;
|
||||||
SetPageReferenced(head);
|
folio_set_referenced(folio);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user