Based on mm/mm-new. In the future, as we decouple "struct page" from "struct folio", pages that support "non-lru page migration" -- movable_ops page migration such as memory balloons and zsmalloc -- will no longer be folios. They will not have ->mapping, ->lru, and likely no refcount and no page lock. But they will have a type and flags 🙂
This is the first part (other parts not written yet) of decoupling movable_ops page migration from folio migration. In this series, we get rid of the ->mapping usage, and start cleaning up the code + separating it from folio migration. Migration core will have to be further reworked to not treat movable_ops pages like folios. This is the first step into that direction. Heavily tested with virtio-balloon and lightly tested with zsmalloc on x86-64. Cross-compile-tested. v1 -> v2: * "mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize()" -> Extended patch description * "mm/page_alloc: let page freeing clear any set page type" -> Add comment * "mm/zsmalloc: make PageZsmalloc() sticky until the page is freed" -> Add comment * "mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()" -> Extended patch description * "mm/migrate: remove folio_test_movable() and folio_movable_ops()" -> Extended patch description * "mm/zsmalloc: stop using __ClearPageMovable()" -> Clarify+extend comment * "mm/migration: remove PageMovable()" -> Adjust patch description * "mm: rename __PageMovable() to page_has_movable_ops()" -> Update comment in scan_movable_pages() * "mm: convert "movable" flag in page->mapping to a page flag" -> Updated+extended patch description -> Use TESTPAGEFLAG+SETPAGEFLAG only -> Adjust comments for #else + #endif * "mm/page-alloc: remove PageMappingFlags()" -> Extend patch description * "docs/mm: convert from "Non-LRU page migration" to "movable_ops page migration"" -> Fixup usage of page_movable_ops() * Smaller patch description changes * Collect RBs+Acks (thanks everybody!) RFC -> v1: * Some smaller fixups + comment changes + subject/description updates * Added ACKs/RBs (hope I didn't miss any) * "mm/migrate: move movable_ops page handling out of move_to_new_folio()" -> Fix goto out; vs goto out_unlock_both; * "mm: remove __folio_test_movable()" -> Fix page_has_movable_ops() checking wrong page Cc: Andrew Morton <a...@linux-foundation.org> Cc: Jonathan Corbet <cor...@lwn.net> Cc: Madhavan Srinivasan <ma...@linux.ibm.com> Cc: Michael Ellerman <m...@ellerman.id.au> Cc: Nicholas Piggin <npig...@gmail.com> Cc: Christophe Leroy <christophe.le...@csgroup.eu> Cc: Jerrin Shaji George <jerrin.shaji-geo...@broadcom.com> Cc: Arnd Bergmann <a...@arndb.de> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: "Michael S. Tsirkin" <m...@redhat.com> Cc: David Hildenbrand <da...@redhat.com> Cc: Jason Wang <jasow...@redhat.com> Cc: Xuan Zhuo <xuanz...@linux.alibaba.com> Cc: "Eugenio Pérez" <epere...@redhat.com> Cc: Alexander Viro <v...@zeniv.linux.org.uk> Cc: Christian Brauner <brau...@kernel.org> Cc: Jan Kara <j...@suse.cz> Cc: Zi Yan <z...@nvidia.com> Cc: Matthew Brost <matthew.br...@intel.com> Cc: Joshua Hahn <joshua.hah...@gmail.com> Cc: Rakie Kim <rakie....@sk.com> Cc: Byungchul Park <byungc...@sk.com> Cc: Gregory Price <gou...@gourry.net> Cc: Ying Huang <ying.hu...@linux.alibaba.com> Cc: Alistair Popple <apop...@nvidia.com> Cc: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> Cc: "Liam R. Howlett" <liam.howl...@oracle.com> Cc: Vlastimil Babka <vba...@suse.cz> Cc: Mike Rapoport <r...@kernel.org> Cc: Suren Baghdasaryan <sur...@google.com> Cc: Michal Hocko <mho...@suse.com> Cc: "Matthew Wilcox (Oracle)" <wi...@infradead.org> Cc: Minchan Kim <minc...@kernel.org> Cc: Sergey Senozhatsky <senozhat...@chromium.org> Cc: Brendan Jackman <jackm...@google.com> Cc: Johannes Weiner <han...@cmpxchg.org> Cc: Jason Gunthorpe <j...@ziepe.ca> Cc: John Hubbard <jhubb...@nvidia.com> Cc: Peter Xu <pet...@redhat.com> Cc: Xu Xin <xu.xi...@zte.com.cn> Cc: Chengming Zhou <chengming.z...@linux.dev> Cc: Miaohe Lin <linmia...@huawei.com> Cc: Naoya Horiguchi <nao.horigu...@gmail.com> Cc: Oscar Salvador <osalva...@suse.de> Cc: Rik van Riel <r...@surriel.com> Cc: Harry Yoo <harry....@oracle.com> Cc: Qi Zheng <zhengqi.a...@bytedance.com> Cc: Shakeel Butt <shakeel.b...@linux.dev> David Hildenbrand (29): mm/balloon_compaction: we cannot have isolated pages in the balloon list mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize() mm/zsmalloc: drop PageIsolated() related VM_BUG_ONs mm/page_alloc: let page freeing clear any set page type mm/balloon_compaction: make PageOffline sticky until the page is freed mm/zsmalloc: make PageZsmalloc() sticky until the page is freed mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page() mm/migrate: rename putback_movable_folio() to putback_movable_ops_page() mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page() mm/migrate: remove folio_test_movable() and folio_movable_ops() mm/migrate: move movable_ops page handling out of move_to_new_folio() mm/zsmalloc: stop using __ClearPageMovable() mm/balloon_compaction: stop using __ClearPageMovable() mm/migrate: remove __ClearPageMovable() mm/migration: remove PageMovable() mm: rename __PageMovable() to page_has_movable_ops() mm/page_isolation: drop __folio_test_movable() check for large folios mm: remove __folio_test_movable() mm: stop storing migration_ops in page->mapping mm: convert "movable" flag in page->mapping to a page flag mm: rename PG_isolated to PG_movable_ops_isolated mm/page-flags: rename PAGE_MAPPING_MOVABLE to PAGE_MAPPING_ANON_KSM mm/page-alloc: remove PageMappingFlags() mm/page-flags: remove folio_mapping_flags() mm: simplify folio_expected_ref_count() mm: rename PAGE_MAPPING_* to FOLIO_MAPPING_* docs/mm: convert from "Non-LRU page migration" to "movable_ops page migration" mm/balloon_compaction: "movable_ops" doc updates mm/balloon_compaction: provide single balloon_page_insert() and balloon_mapping_gfp_mask() Documentation/mm/page_migration.rst | 39 ++-- arch/powerpc/platforms/pseries/cmm.c | 2 +- drivers/misc/vmw_balloon.c | 3 +- drivers/virtio/virtio_balloon.c | 4 +- fs/proc/page.c | 4 +- include/linux/balloon_compaction.h | 90 ++++----- include/linux/fs.h | 2 +- include/linux/migrate.h | 46 +---- include/linux/mm.h | 4 +- include/linux/mm_types.h | 1 - include/linux/page-flags.h | 106 +++++++---- include/linux/pagemap.h | 2 +- include/linux/zsmalloc.h | 2 + mm/balloon_compaction.c | 21 ++- mm/compaction.c | 44 +---- mm/gup.c | 4 +- mm/internal.h | 2 +- mm/ksm.c | 4 +- mm/memory-failure.c | 4 +- mm/memory_hotplug.c | 10 +- mm/migrate.c | 271 ++++++++++++++++----------- mm/page_alloc.c | 13 +- mm/page_isolation.c | 12 +- mm/rmap.c | 16 +- mm/util.c | 6 +- mm/vmscan.c | 6 +- mm/zpdesc.h | 15 +- mm/zsmalloc.c | 33 ++-- 28 files changed, 373 insertions(+), 393 deletions(-) base-commit: 31a2460cb90e6ac3604c72fb54e936b8129fec05 -- 2.49.0