mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm/migrate: Add native folio functions
@ 2026-06-08  0:12 yahia
  2026-06-08  0:29 ` Zi Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: yahia @ 2026-06-08  0:12 UTC (permalink / raw)
  To: akpm; +Cc: david, ziy, linux-mm, linux-kernel, yahia

Hello,

I aim provides in this patch to provide native
folio abstractions for page functions like movable_ops
by wrapping folio->page structure in the native page function

Signed-off-by: yahia <yahia.a.abdrabou@gmail.com>
---
 include/linux/page-flags.h | 7 +++++++
 mm/migrate.c               | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 7223f6f4e2b4..6776cf821edd 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1110,6 +1110,7 @@ bool is_free_buddy_page(const struct page *page);
  */
 TESTPAGEFLAG(MovableOps, movable_ops, PF_NO_TAIL);
 SETPAGEFLAG(MovableOps, movable_ops, PF_NO_TAIL);
+FOLIO_TEST_FLAG(MovableOpsIsolated, movable_ops_isolated)
 /*
  * A movable_ops page has this flag set while it is isolated for migration.
  * This flag primarily protects against concurrent migration attempts.
@@ -1139,6 +1140,12 @@ static inline bool page_has_movable_ops(const struct page *page)
 	       (PageOffline(page) || PageZsmalloc(page));
 }
 
+static inline bool folio_has_movable_ops(struct folio *folio)
+{
+	return PageMovableOps(&folio->page) &&
+		(PageOffline(&folio->page) || PageZsmalloc(&folio->page));
+}
+
 static __always_inline int PageAnonExclusive(const struct page *page)
 {
 	VM_BUG_ON_PGFLAGS(!PageAnon(page), page);
diff --git a/mm/migrate.c b/mm/migrate.c
index 8a64291ab5b4..817a8c0b84d9 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -96,6 +96,11 @@ static const struct movable_operations *page_movable_ops(struct page *page)
 	return NULL;
 }
 
+static const struct movable_operations *folio_movable_ops(struct folio *folio)
+{
+	return page_movable_ops(&folio->page);
+}
+
 /**
  * isolate_movable_ops_page - isolate a movable_ops page for migration
  * @page: The page.
-- 
2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-08 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08  0:12 [PATCH] mm/migrate: Add native folio functions yahia
2026-06-08  0:29 ` Zi Yan
2026-06-08 16:46   ` David Hildenbrand (Arm)
2026-06-08  3:18 ` kernel test robot
2026-06-08  4:29 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome