mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
mm: add folio_is_pci_p2pdma()
Reimplement is_pci_p2pdma_page() in terms of folio_is_pci_p2pdma(). Moves the page_folio() call from inside page_pgmap() to is_pci_p2pdma_page(). This removes a page_folio() call from try_grab_folio() which already has a folio and can pass it in. Link: https://lkml.kernel.org/r/20250805172307.1302730-12-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
c995ac3aa3
commit
88df6ab2f3
|
|
@ -170,11 +170,17 @@ static inline bool is_device_private_page(const struct page *page)
|
|||
folio_is_device_private(page_folio(page));
|
||||
}
|
||||
|
||||
static inline bool folio_is_pci_p2pdma(const struct folio *folio)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_PCI_P2PDMA) &&
|
||||
folio_is_zone_device(folio) &&
|
||||
folio->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
|
||||
}
|
||||
|
||||
static inline bool is_pci_p2pdma_page(const struct page *page)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_PCI_P2PDMA) &&
|
||||
is_zone_device_page(page) &&
|
||||
page_pgmap(page)->type == MEMORY_DEVICE_PCI_P2PDMA;
|
||||
folio_is_pci_p2pdma(page_folio(page));
|
||||
}
|
||||
|
||||
static inline bool folio_is_device_coherent(const struct folio *folio)
|
||||
|
|
|
|||
2
mm/gup.c
2
mm/gup.c
|
|
@ -148,7 +148,7 @@ int __must_check try_grab_folio(struct folio *folio, int refs,
|
|||
if (WARN_ON_ONCE(folio_ref_count(folio) <= 0))
|
||||
return -ENOMEM;
|
||||
|
||||
if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(&folio->page)))
|
||||
if (unlikely(!(flags & FOLL_PCI_P2PDMA) && folio_is_pci_p2pdma(folio)))
|
||||
return -EREMOTEIO;
|
||||
|
||||
if (flags & FOLL_GET)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user