Skip to content

mm/migration: rework movable_ops page migration (part 1)

David Hildenbrand linux-doc linux-fsdevel linux-mm linuxppc-dev lkml virtualization 2 versions – Applied

Status from this message: [merged mm-stable] mm-balloon_compaction-provide-single-balloon_page_insert-and-balloon_mapping_gfp_mask.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest29 patches 3 repliesApplied 29/29
  2. v129 patches 108 repliesSuperseded

Changes in v2 from the cover letter · 22 lines

* "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!)

Patches in v2 All 29 applied

#Subject and filesSizeRepliesApplied
1/29mm/balloon_compaction: we cannot have isolated pages in the balloon listmm/balloon_compaction.c+0 -60 repliesApplied
2/29mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize()arch/powerpc/platforms/pseries/cmm.c drivers/misc/vmw_balloon.c drivers/virtio/virtio_balloon.c +2 more+21 -340 repliesApplied
3/29mm/zsmalloc: drop PageIsolated() related VM_BUG_ONsmm/zpdesc.h mm/zsmalloc.c+0 -100 repliesApplied
4/29mm/page_alloc: let page freeing clear any set page typemm/page_alloc.c+4 -00 repliesApplied
5/29mm/balloon_compaction: make PageOffline sticky until the page is freedinclude/linux/balloon_compaction.h+1 -10 repliesApplied
6/29mm/zsmalloc: make PageZsmalloc() sticky until the page is freedmm/zpdesc.h mm/zsmalloc.c+2 -70 repliesApplied
7/29mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page()include/linux/migrate.h mm/compaction.c mm/migrate.c+32 -130 repliesApplied
8/29mm/migrate: rename putback_movable_folio() to putback_movable_ops_page()mm/migrate.c+24 -130 repliesApplied
9/29mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()mm/migrate.c+45 -370 repliesApplied
10/29mm/migrate: remove folio_test_movable() and folio_movable_ops()include/linux/migrate.h+0 -140 repliesApplied
11/29mm/migrate: move movable_ops page handling out of move_to_new_folio()mm/migrate.c+30 -330 repliesApplied
12/29mm/zsmalloc: stop using __ClearPageMovable()mm/zsmalloc.c+14 -41 replyApplied
13/29mm/balloon_compaction: stop using __ClearPageMovable()include/linux/balloon_compaction.h mm/balloon_compaction.c+12 -30 repliesApplied
14/29mm/migrate: remove __ClearPageMovable()include/linux/migrate.h mm/compaction.c+2 -170 repliesApplied
15/29mm/migration: remove PageMovable()include/linux/migrate.h mm/compaction.c mm/migrate.c+10 -250 repliesApplied
16/29mm: rename __PageMovable() to page_has_movable_ops()include/linux/migrate.h include/linux/page-flags.h mm/compaction.c +5 more+20 -250 repliesApplied
17/29mm/page_isolation: drop __folio_test_movable() check for large foliosmm/page_isolation.c+1 -10 repliesApplied
18/29mm: remove __folio_test_movable()include/linux/page-flags.h mm/migrate.c mm/vmscan.c+17 -380 repliesApplied
19/29mm: stop storing migration_ops in page->mappinginclude/linux/balloon_compaction.h include/linux/migrate.h include/linux/zsmalloc.h +5 more+35 -250 repliesApplied
20/29mm: convert "movable" flag in page->mapping to a page flaginclude/linux/balloon_compaction.h include/linux/migrate.h include/linux/page-flags.h +2 more+46 -261 replyApplied
21/29mm: rename PG_isolated to PG_movable_ops_isolatedinclude/linux/page-flags.h mm/compaction.c mm/migrate.c+19 -130 repliesApplied
22/29mm/page-flags: rename PAGE_MAPPING_MOVABLE to PAGE_MAPPING_ANON_KSMinclude/linux/page-flags.h+6 -60 repliesApplied
23/29mm/page-alloc: remove PageMappingFlags()include/linux/page-flags.h mm/page_alloc.c+3 -90 repliesApplied
24/29mm/page-flags: remove folio_mapping_flags()include/linux/page-flags.h+0 -50 repliesApplied
25/29mm: simplify folio_expected_ref_count()include/linux/mm.h+2 -20 repliesApplied
26/29mm: rename PAGE_MAPPING_* to FOLIO_MAPPING_*fs/proc/page.c include/linux/fs.h include/linux/mm_types.h +7 more+30 -310 repliesApplied
27/29docs/mm: convert from "Non-LRU page migration" to "movable_ops page migration"Documentation/mm/page_migration.rst+27 -120 repliesApplied
28/29mm/balloon_compaction: "movable_ops" doc updatesinclude/linux/balloon_compaction.h+6 -70 repliesApplied
29/29mm/balloon_compaction: provide single balloon_page_insert() and balloon_mapping_gfp_mask()include/linux/balloon_compaction.h+15 -270 repliesApplied

Reviews trailers per patch

All 29 patches have a Reviewed-by or Acked-by.

PatchZi YanLorenzo StoakesSergey SenozhatskyHarry Yoo
1/29A-b R-b
2/29R-b
3/29A-b R-b R-b A-b
4/29R-b R-b A-b
5/29A-b R-b A-b
6/29A-b R-b R-b A-b
7/29R-b R-b R-b
8/29R-b R-b R-b
9/29R-b R-b
10/29R-b R-b R-b
11/29R-b R-b R-b
12/29R-b R-b R-b
13/29R-b
14/29R-b R-b R-b
15/29R-b R-b R-b
16/29R-b R-b R-b
17/29R-b R-b R-b
18/29R-b R-b R-b
19/29R-b R-b R-b
20/29R-b R-b
21/29R-b R-b R-b
22/29R-b R-b R-b
23/29R-b R-b R-b
24/29R-b R-b R-b
25/29R-b R-b R-b
26/29R-b R-b R-b
27/29R-b R-b R-b
28/29R-b
29/29R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/29] mm/migration: rework movable_ops page migration (part 1)

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 <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Jerrin Shaji George <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Jason Wang <[email protected]>
Cc Xuan Zhuo <[email protected]>
Cc "Eugenio Pérez" <[email protected]>
Cc Alexander Viro <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Jan Kara <[email protected]>
Cc Zi Yan <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Gregory Price <[email protected]>
Cc Ying Huang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Michal Hocko <[email protected]>
Cc "Matthew Wilcox (Oracle)" <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Brendan Jackman <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc John Hubbard <[email protected]>
Cc Peter Xu <[email protected]>
Cc Xu Xin <[email protected]>
Cc Chengming Zhou <[email protected]>
Cc Miaohe Lin <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Harry Yoo <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Shakeel Butt <[email protected]>

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

Signature · 1 line
2.49.0