[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230130214352.40538-2-vishal.moola@gmail.com>
Date: Mon, 30 Jan 2023 13:43:49 -0800
From: "Vishal Moola (Oracle)" <vishal.moola@...il.com>
To: linux-mm@...ck.org
Cc: akpm@...ux-foundation.org, willy@...radead.org,
linux-kernel@...r.kernel.org,
"Vishal Moola (Oracle)" <vishal.moola@...il.com>
Subject: [PATCH mm-unstable v2 1/4] mm: Add folio_get_nontail_page()
folio_get_nontail_page() returns the folio associated with a head
page. This is necessary for folio conversions where the behavior of that
function differs between head pages and tail pages.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
---
include/linux/mm.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index dd295c020e85..5da260346406 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -879,6 +879,13 @@ static inline bool get_page_unless_zero(struct page *page)
return page_ref_add_unless(page, 1, 0);
}
+static inline struct folio *folio_get_nontail_page(struct page *page)
+{
+ if (unlikely(!get_page_unless_zero(page)))
+ return NULL;
+ return (struct folio *)page;
+}
+
extern int page_is_ram(unsigned long pfn);
enum {
--
2.38.1
Powered by blists - more mailing lists