Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

migrate: replace RMP_ flags with TTU_ flags

Instead of translating between RMP_ and TTU_ flags, remove the RMP_ flags
and just use the TTU_ flag space; there's plenty available.

Possibly we should rename these to RMAP_ flags, and maybe even pass them
in through rmap_walk_arg, but that can be done later.

Link: https://lkml.kernel.org/r/20260109041345.3863089-3-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Gregory Price <gourry@gourry.net>
Cc: Jann Horn <jannh@google.com>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Ying Huang <ying.huang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
832d95b5 3d702678

+13 -16
+3 -6
include/linux/rmap.h
··· 92 92 }; 93 93 94 94 enum ttu_flags { 95 + TTU_USE_SHARED_ZEROPAGE = 0x2, /* for unused pages of large folios */ 95 96 TTU_SPLIT_HUGE_PMD = 0x4, /* split huge PMD if any */ 96 97 TTU_IGNORE_MLOCK = 0x8, /* ignore mlock */ 97 98 TTU_SYNC = 0x10, /* avoid racy checks with PVMW_SYNC */ ··· 934 933 int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff, 935 934 struct vm_area_struct *vma); 936 935 937 - enum rmp_flags { 938 - RMP_LOCKED = 1 << 0, 939 - RMP_USE_SHARED_ZEROPAGE = 1 << 1, 940 - }; 941 - 942 - void remove_migration_ptes(struct folio *src, struct folio *dst, int flags); 936 + void remove_migration_ptes(struct folio *src, struct folio *dst, 937 + enum ttu_flags flags); 943 938 944 939 /* 945 940 * rmap_walk_control: To control rmap traversing for specific needs
+4 -4
mm/huge_memory.c
··· 3431 3431 if (!folio_test_anon(folio)) 3432 3432 return; 3433 3433 for (;;) { 3434 - remove_migration_ptes(folio, folio, RMP_LOCKED | flags); 3434 + remove_migration_ptes(folio, folio, TTU_RMAP_LOCKED | flags); 3435 3435 i += folio_nr_pages(folio); 3436 3436 if (i >= nr) 3437 3437 break; ··· 3944 3944 int old_order = folio_order(folio); 3945 3945 struct folio *new_folio, *next; 3946 3946 int nr_shmem_dropped = 0; 3947 - int remap_flags = 0; 3947 + enum ttu_flags ttu_flags = 0; 3948 3948 int ret; 3949 3949 pgoff_t end = 0; 3950 3950 ··· 4064 4064 shmem_uncharge(mapping->host, nr_shmem_dropped); 4065 4065 4066 4066 if (!ret && is_anon && !folio_is_device_private(folio)) 4067 - remap_flags = RMP_USE_SHARED_ZEROPAGE; 4067 + ttu_flags = TTU_USE_SHARED_ZEROPAGE; 4068 4068 4069 - remap_page(folio, 1 << old_order, remap_flags); 4069 + remap_page(folio, 1 << old_order, ttu_flags); 4070 4070 4071 4071 /* 4072 4072 * Unlock all after-split folios except the one containing
+6 -6
mm/migrate.c
··· 452 452 * Get rid of all migration entries and replace them by 453 453 * references to the indicated page. 454 454 */ 455 - void remove_migration_ptes(struct folio *src, struct folio *dst, int flags) 455 + void remove_migration_ptes(struct folio *src, struct folio *dst, 456 + enum ttu_flags flags) 456 457 { 457 458 struct rmap_walk_arg rmap_walk_arg = { 458 459 .folio = src, 459 - .map_unused_to_zeropage = flags & RMP_USE_SHARED_ZEROPAGE, 460 + .map_unused_to_zeropage = flags & TTU_USE_SHARED_ZEROPAGE, 460 461 }; 461 462 462 463 struct rmap_walk_control rwc = { ··· 465 464 .arg = &rmap_walk_arg, 466 465 }; 467 466 468 - VM_BUG_ON_FOLIO((flags & RMP_USE_SHARED_ZEROPAGE) && (src != dst), src); 467 + VM_BUG_ON_FOLIO((flags & TTU_USE_SHARED_ZEROPAGE) && (src != dst), src); 469 468 470 - if (flags & RMP_LOCKED) 469 + if (flags & TTU_RMAP_LOCKED) 471 470 rmap_walk_locked(dst, &rwc); 472 471 else 473 472 rmap_walk(dst, &rwc); ··· 1522 1521 rc = move_to_new_folio(dst, src, mode); 1523 1522 1524 1523 if (page_was_mapped) 1525 - remove_migration_ptes(src, !rc ? dst : src, 1526 - ttu ? RMP_LOCKED : 0); 1524 + remove_migration_ptes(src, !rc ? dst : src, ttu); 1527 1525 1528 1526 if (ttu & TTU_RMAP_LOCKED) 1529 1527 i_mmap_unlock_write(mapping);