Re: [PATCH RFC 20/29] mm: convert "movable" flag in page->mapping to a page flag

From: David Hildenbrand
Date: Mon Jun 23 2025 - 11:58:10 EST


On 23.06.25 16:14, Zi Yan wrote:
On 18 Jun 2025, at 13:40, David Hildenbrand wrote:

Instead, let's use a page flag. As the page flag can result in
false-positives, glue it to the page types for which we
support/implement movable_ops page migration.

Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
---
include/linux/balloon_compaction.h | 2 +-
include/linux/migrate.h | 8 -----
include/linux/page-flags.h | 52 ++++++++++++++++++++++++------
mm/compaction.c | 6 ----
mm/zpdesc.h | 2 +-
5 files changed, 44 insertions(+), 26 deletions(-)


<snip>

+
+/**
+ * page_has_movable_ops - test for a movable_ops page
+ * @page The page to test.
+ *
+ * Test whether this is a movable_ops page. Such pages will stay that
+ * way until freed.
+ *
+ * Returns true if this is a movable_ops page, otherwise false.
+ */
+static inline bool page_has_movable_ops(const struct page *page)
+{
+ return PageMovableOps(page) &&
+ (PageOffline(page) || PageZsmalloc(page));
+}
+

Should we do the code below in case PageMovableOps is set on pages
other than PageOffline and PageZsmalloc?

return PageMovableOps(page) &&
!VM_WARN_ON_ONCE_PAGE(!(PageOffline(page) || PageZsmalloc(page)),
page);

I think this could trigger in some corner when other pages (esp. folios?) reuse the flag and we run into some weird races while we don't hold any reference on the page.

--
Cheers,

David / dhildenb