]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: reimplement folio_is_device_coherent()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 5 Aug 2025 17:22:59 +0000 (18:22 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:08 +0000 (17:25 -0700)
For callers of folio_is_device_coherent(), we save a folio->page->folio
conversion.  Callers of is_device_coherent_page() simply move the
conversion of page->folio from the implementation of page_pgmap() to
is_device_coherent_page().

Link: https://lkml.kernel.org/r/20250805172307.1302730-10-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/memremap.h

index 5d18cb7a70e54cbc7ea717b1ba6a3dfc71551126..06d29794abe6adfa6becc786a5c0b6c69000f754 100644 (file)
@@ -177,15 +177,15 @@ static inline bool is_pci_p2pdma_page(const struct page *page)
                page_pgmap(page)->type == MEMORY_DEVICE_PCI_P2PDMA;
 }
 
-static inline bool is_device_coherent_page(const struct page *page)
+static inline bool folio_is_device_coherent(const struct folio *folio)
 {
-       return is_zone_device_page(page) &&
-               page_pgmap(page)->type == MEMORY_DEVICE_COHERENT;
+       return folio_is_zone_device(folio) &&
+               folio->pgmap->type == MEMORY_DEVICE_COHERENT;
 }
 
-static inline bool folio_is_device_coherent(const struct folio *folio)
+static inline bool is_device_coherent_page(const struct page *page)
 {
-       return is_device_coherent_page(&folio->page);
+       return folio_is_device_coherent(page_folio(page));
 }
 
 static inline bool is_fsdax_page(const struct page *page)