]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Add folio_pfn()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 7 May 2021 14:55:27 +0000 (10:55 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 14 Aug 2021 14:33:50 +0000 (10:33 -0400)
This is the folio equivalent of page_to_pfn().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/mm.h

index 98f7e013c0e7e77b8a4e184fd109552e8dbafca6..69c1e88a7da97c946d278ae23aa1acaccc57c2c8 100644 (file)
@@ -1623,6 +1623,20 @@ static inline unsigned long page_to_section(const struct page *page)
 }
 #endif
 
+/**
+ * folio_pfn - Return the Page Frame Number of a folio.
+ * @folio: The folio.
+ *
+ * A folio may contain multiple pages.  The pages have consecutive
+ * Page Frame Numbers.
+ *
+ * Return: The Page Frame Number of the first page in the folio.
+ */
+static inline unsigned long folio_pfn(struct folio *folio)
+{
+       return page_to_pfn(&folio->page);
+}
+
 /* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */
 #ifdef CONFIG_MIGRATION
 static inline bool is_pinnable_page(struct page *page)