diff mbox series

[38/75] mm: Add folio_is_zone_device() and folio_is_device_private()

Message ID 20220204195852.1751729-39-willy@infradead.org (mailing list archive)
State New
Headers show
Series MM folio patches for 5.18 | expand

Commit Message

Matthew Wilcox Feb. 4, 2022, 7:58 p.m. UTC
These two wrappers are the equivalent of is_zone_device_page()
and is_device_private_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/mm.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Christoph Hellwig Feb. 7, 2022, 7:54 a.m. UTC | #1
On Fri, Feb 04, 2022 at 07:58:15PM +0000, Matthew Wilcox (Oracle) wrote:
> These two wrappers are the equivalent of is_zone_device_page()
> and is_device_private_page().

The looks sane, but I just send out a series this morning that moves
is_device_private_page to memremap.h and removes the inclusion of
memremap.h in mm.h, so there will be a bit of a conflict.
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6a19cd97d5aa..028bd9336e82 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1096,6 +1096,11 @@  static inline bool is_zone_device_page(const struct page *page)
 }
 #endif
 
+static inline bool folio_is_zone_device(const struct folio *folio)
+{
+	return is_zone_device_page(&folio->page);
+}
+
 static inline bool is_zone_movable_page(const struct page *page)
 {
 	return page_zonenum(page) == ZONE_MOVABLE;
@@ -1142,6 +1147,11 @@  static inline bool is_device_private_page(const struct page *page)
 		page->pgmap->type == MEMORY_DEVICE_PRIVATE;
 }
 
+static inline bool folio_is_device_private(const struct folio *folio)
+{
+	return is_device_private_page(&folio->page);
+}
+
 static inline bool is_pci_p2pdma_page(const struct page *page)
 {
 	return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&