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 <da...@redhat.com> > --- > 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); > static __always_inline int PageAnonExclusive(const struct page *page) > { > VM_BUG_ON_PGFLAGS(!PageAnon(page), page); > diff --git a/mm/compaction.c b/mm/compaction.c > index a10f23df9396e..86d671a520e91 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -114,12 +114,6 @@ static unsigned long release_free_list(struct list_head > *freepages) > } > > #ifdef CONFIG_COMPACTION > -void __SetPageMovable(struct page *page) > -{ > - VM_BUG_ON_PAGE(!PageLocked(page), page); > - page->mapping = (void *)(PAGE_MAPPING_MOVABLE); > -} > -EXPORT_SYMBOL(__SetPageMovable); > > /* Do not skip compaction more than 64 times */ > #define COMPACT_MAX_DEFER_SHIFT 6 > diff --git a/mm/zpdesc.h b/mm/zpdesc.h > index 6855d9e2732d8..25bf5ea0beb83 100644 > --- a/mm/zpdesc.h > +++ b/mm/zpdesc.h > @@ -154,7 +154,7 @@ static inline struct zpdesc *pfn_zpdesc(unsigned long pfn) > > static inline void __zpdesc_set_movable(struct zpdesc *zpdesc) > { > - __SetPageMovable(zpdesc_page(zpdesc)); > + SetPageMovableOps(zpdesc_page(zpdesc)); > } > > static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc) > -- > 2.49.0 Otherwise, LGTM. Reviewed-by: Zi Yan <z...@nvidia.com> -- Best Regards, Yan, Zi