diff mbox series

[v2,01/46] mm: Add folio_to_pfn()

Message ID 20210622121551.3398730-2-willy@infradead.org (mailing list archive)
State New
Headers show
Series Folio-enabling the page cache | expand

Commit Message

Matthew Wilcox (Oracle) June 22, 2021, 12:15 p.m. UTC
The pfn of a folio is the pfn of its head page.

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

Comments

Christoph Hellwig June 23, 2021, 7:49 a.m. UTC | #1
On Tue, Jun 22, 2021 at 01:15:06PM +0100, Matthew Wilcox (Oracle) wrote:
> The pfn of a folio is the pfn of its head page.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Maybe add a kerneldoc comment stating that?
Matthew Wilcox (Oracle) June 24, 2021, 3:12 p.m. UTC | #2
On Wed, Jun 23, 2021 at 08:49:55AM +0100, Christoph Hellwig wrote:
> On Tue, Jun 22, 2021 at 01:15:06PM +0100, Matthew Wilcox (Oracle) wrote:
> > The pfn of a folio is the pfn of its head page.
> > 
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> 
> Maybe add a kerneldoc comment stating that?

/**
 * folio_to_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.
 */
Christoph Hellwig June 28, 2021, 6:18 a.m. UTC | #3
On Thu, Jun 24, 2021 at 04:12:05PM +0100, Matthew Wilcox wrote:
> On Wed, Jun 23, 2021 at 08:49:55AM +0100, Christoph Hellwig wrote:
> > On Tue, Jun 22, 2021 at 01:15:06PM +0100, Matthew Wilcox (Oracle) wrote:
> > > The pfn of a folio is the pfn of its head page.
> > > 
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > 
> > Maybe add a kerneldoc comment stating that?
> 
> /**
>  * folio_to_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.
>  */

Looks fine.
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9b7030d1899f..2c7b6ae1d3fc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1619,6 +1619,11 @@  static inline unsigned long page_to_section(const struct page *page)
 }
 #endif
 
+static inline unsigned long folio_to_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)