linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 07/11] mm: Introduce memdesc_is_zone_device()
Date: Tue,  5 Aug 2025 18:22:57 +0100	[thread overview]
Message-ID: <20250805172307.1302730-8-willy@infradead.org> (raw)
In-Reply-To: <20250805172307.1302730-1-willy@infradead.org>

Remove the conversion from folio to page in folio_is_zone_device()
by introducing memdesc_is_zone_device() which takes a memdesc_flags_t
from either a page or a folio.

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

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 001a696756df..0210f7eea825 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1186,14 +1186,14 @@ static inline enum zone_type folio_zonenum(const struct folio *folio)
 }
 
 #ifdef CONFIG_ZONE_DEVICE
-static inline bool is_zone_device_page(const struct page *page)
+static inline bool memdesc_is_zone_device(memdesc_flags_t mdf)
 {
-	return page_zonenum(page) == ZONE_DEVICE;
+	return memdesc_zonenum(mdf) == ZONE_DEVICE;
 }
 
 static inline struct dev_pagemap *page_pgmap(const struct page *page)
 {
-	VM_WARN_ON_ONCE_PAGE(!is_zone_device_page(page), page);
+	VM_WARN_ON_ONCE_PAGE(!memdesc_is_zone_device(page->flags), page);
 	return page_folio(page)->pgmap;
 }
 
@@ -1208,9 +1208,9 @@ static inline struct dev_pagemap *page_pgmap(const struct page *page)
 static inline bool zone_device_pages_have_same_pgmap(const struct page *a,
 						     const struct page *b)
 {
-	if (is_zone_device_page(a) != is_zone_device_page(b))
+	if (memdesc_is_zone_device(a->flags) != memdesc_is_zone_device(b->flags))
 		return false;
-	if (!is_zone_device_page(a))
+	if (!memdesc_is_zone_device(a->flags))
 		return true;
 	return page_pgmap(a) == page_pgmap(b);
 }
@@ -1218,7 +1218,7 @@ static inline bool zone_device_pages_have_same_pgmap(const struct page *a,
 extern void memmap_init_zone_device(struct zone *, unsigned long,
 				    unsigned long, struct dev_pagemap *);
 #else
-static inline bool is_zone_device_page(const struct page *page)
+static inline bool memdesc_is_zone_device(memdesc_flags_t mdf)
 {
 	return false;
 }
@@ -1233,9 +1233,14 @@ static inline struct dev_pagemap *page_pgmap(const struct page *page)
 }
 #endif
 
+static inline bool is_zone_device_page(const struct page *page)
+{
+	return memdesc_is_zone_device(page->flags);
+}
+
 static inline bool folio_is_zone_device(const struct folio *folio)
 {
-	return is_zone_device_page(&folio->page);
+	return memdesc_is_zone_device(folio->flags);
 }
 
 static inline bool is_zone_movable_page(const struct page *page)
-- 
2.47.2



  parent reply	other threads:[~2025-08-05 17:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 17:22 [PATCH 00/11] Add and use memdesc_flags_t Matthew Wilcox (Oracle)
2025-08-05 17:22 ` [PATCH 01/11] mm: Introduce memdesc_flags_t Matthew Wilcox (Oracle)
2025-08-06 18:24   ` Zi Yan
2025-08-19 17:49   ` Kairui Song
2025-08-19 17:58     ` Matthew Wilcox
2025-08-19 18:03       ` Kairui Song
2025-08-05 17:22 ` [PATCH 02/11] mm: Convert page_to_section() to memdesc_section() Matthew Wilcox (Oracle)
2025-08-06 18:31   ` Zi Yan
2025-08-05 17:22 ` [PATCH 03/11] mm: Introduce memdesc_nid() Matthew Wilcox (Oracle)
2025-08-06 18:47   ` Zi Yan
2025-08-06 19:04     ` Matthew Wilcox
2025-08-06 19:07       ` Zi Yan
2025-08-05 17:22 ` [PATCH 04/11] mm: Introduce memdesc_zonenum() Matthew Wilcox (Oracle)
2025-08-06 18:57   ` Zi Yan
2025-08-05 17:22 ` [PATCH 05/11] slab: Use memdesc_flags_t Matthew Wilcox (Oracle)
2025-08-06 19:16   ` Zi Yan
2025-08-05 17:22 ` [PATCH 06/11] slab: Use memdesc_nid() Matthew Wilcox (Oracle)
2025-08-06 19:17   ` Zi Yan
2025-08-05 17:22 ` Matthew Wilcox (Oracle) [this message]
2025-08-06 19:22   ` [PATCH 07/11] mm: Introduce memdesc_is_zone_device() Zi Yan
2025-08-05 17:22 ` [PATCH 08/11] mm: Reimplement folio_is_device_private() Matthew Wilcox (Oracle)
2025-08-06 19:25   ` Zi Yan
2025-08-05 17:22 ` [PATCH 09/11] mm: Reimplement folio_is_device_coherent() Matthew Wilcox (Oracle)
2025-08-06 19:27   ` Zi Yan
2025-08-05 17:23 ` [PATCH 10/11] mm: Reimplement folio_is_fsdax() Matthew Wilcox (Oracle)
2025-08-06 19:27   ` Zi Yan
2025-08-05 17:23 ` [PATCH 11/11] mm: Add folio_is_pci_p2pdma() Matthew Wilcox (Oracle)
2025-08-05 21:40 ` [PATCH 00/11] Add and use memdesc_flags_t Shakeel Butt
2025-08-06 12:55   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250805172307.1302730-8-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox