aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorVishal Moola (Oracle) <[email protected]>2023-01-30 13:43:49 -0800
committerAndrew Morton <[email protected]>2023-02-13 15:54:31 -0800
commit3c1ea2c729ef8ef07bcb80d01ab2ead45b3406dd (patch)
treecc98b8ca8028bb49bb76e4abe203edce6cc79ff4 /include/linux
parent4a64981dfee9119aa2c1f243b48f34cbbd67779c (diff)
mm: add folio_get_nontail_page()
Patch series "Convert a couple migrate functions to use folios", v2. This patchset introduces folio_movable_ops() and converts 3 functions in mm/migrate.c to use folios. It also introduces folio_get_nontail_page() for folio conversions which may want to distinguish between head and tail pages. This patch (of 4): 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. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Vishal Moola (Oracle) <[email protected]> Cc: Matthew Wilcox <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mm.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 89c118ad4a44..2992a2d55aee 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -892,6 +892,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 {