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.

mm: eliminate further swapops predicates

Having converted so much of the code base to software leaf entries, we can
mop up some remaining cases.

We replace is_pfn_swap_entry(), pfn_swap_entry_to_page(),
is_writable_device_private_entry(), is_device_exclusive_entry(),
is_migration_entry(), is_writable_migration_entry(),
is_readable_migration_entry(), swp_offset_pfn() and pfn_swap_entry_folio()
with softleaf equivalents.

No functional change intended.

Link: https://lkml.kernel.org/r/956bc9c031604811c0070d2f4bf2f1373f230213.1762812360.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Chris Li <chrisl@kernel.org>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Gregory Price <gourry@gourry.net>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Xu <weixugc@google.com>
Cc: xu xin <xu.xin16@zte.com.cn>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
93976a20 03bfbc3a

+76 -177
+7 -7
fs/proc/task_mmu.c
··· 1941 1941 if (pte_uffd_wp(pte)) 1942 1942 flags |= PM_UFFD_WP; 1943 1943 } else { 1944 - swp_entry_t entry; 1944 + softleaf_t entry; 1945 1945 1946 1946 if (pte_swp_soft_dirty(pte)) 1947 1947 flags |= PM_SOFT_DIRTY; 1948 1948 if (pte_swp_uffd_wp(pte)) 1949 1949 flags |= PM_UFFD_WP; 1950 - entry = pte_to_swp_entry(pte); 1950 + entry = softleaf_from_pte(pte); 1951 1951 if (pm->show_pfn) { 1952 1952 pgoff_t offset; 1953 1953 ··· 1955 1955 * For PFN swap offsets, keeping the offset field 1956 1956 * to be PFN only to be compatible with old smaps. 1957 1957 */ 1958 - if (is_pfn_swap_entry(entry)) 1959 - offset = swp_offset_pfn(entry); 1958 + if (softleaf_has_pfn(entry)) 1959 + offset = softleaf_to_pfn(entry); 1960 1960 else 1961 1961 offset = swp_offset(entry); 1962 1962 frame = swp_type(entry) | 1963 1963 (offset << MAX_SWAPFILES_SHIFT); 1964 1964 } 1965 1965 flags |= PM_SWAP; 1966 - if (is_pfn_swap_entry(entry)) 1967 - page = pfn_swap_entry_to_page(entry); 1966 + if (softleaf_has_pfn(entry)) 1967 + page = softleaf_to_page(entry); 1968 1968 if (softleaf_is_uffd_wp_marker(entry)) 1969 1969 flags |= PM_UFFD_WP; 1970 1970 if (softleaf_is_guard_marker(entry)) ··· 2033 2033 if (pmd_swp_uffd_wp(pmd)) 2034 2034 flags |= PM_UFFD_WP; 2035 2035 VM_WARN_ON_ONCE(!pmd_is_migration_entry(pmd)); 2036 - page = pfn_swap_entry_to_page(entry); 2036 + page = softleaf_to_page(entry); 2037 2037 } 2038 2038 2039 2039 if (page) {
+20 -7
include/linux/leafops.h
··· 355 355 VM_WARN_ON_ONCE(!softleaf_has_pfn(entry)); 356 356 357 357 /* Temporary until swp_entry_t eliminated. */ 358 - return swp_offset_pfn(entry); 358 + return swp_offset(entry) & SWP_PFN_MASK; 359 359 } 360 360 361 361 /** ··· 366 366 */ 367 367 static inline struct page *softleaf_to_page(softleaf_t entry) 368 368 { 369 - VM_WARN_ON_ONCE(!softleaf_has_pfn(entry)); 369 + struct page *page = pfn_to_page(softleaf_to_pfn(entry)); 370 370 371 - /* Temporary until swp_entry_t eliminated. */ 372 - return pfn_swap_entry_to_page(entry); 371 + VM_WARN_ON_ONCE(!softleaf_has_pfn(entry)); 372 + /* 373 + * Any use of migration entries may only occur while the 374 + * corresponding page is locked 375 + */ 376 + VM_WARN_ON_ONCE(softleaf_is_migration(entry) && !PageLocked(page)); 377 + 378 + return page; 373 379 } 374 380 375 381 /** ··· 386 380 */ 387 381 static inline struct folio *softleaf_to_folio(softleaf_t entry) 388 382 { 389 - VM_WARN_ON_ONCE(!softleaf_has_pfn(entry)); 383 + struct folio *folio = pfn_folio(softleaf_to_pfn(entry)); 390 384 391 - /* Temporary until swp_entry_t eliminated. */ 392 - return pfn_swap_entry_folio(entry); 385 + VM_WARN_ON_ONCE(!softleaf_has_pfn(entry)); 386 + /* 387 + * Any use of migration entries may only occur while the 388 + * corresponding folio is locked. 389 + */ 390 + VM_WARN_ON_ONCE(softleaf_is_migration(entry) && 391 + !folio_test_locked(folio)); 392 + 393 + return folio; 393 394 } 394 395 395 396 /**
+1 -120
include/linux/swapops.h
··· 28 28 #define SWP_OFFSET_MASK ((1UL << SWP_TYPE_SHIFT) - 1) 29 29 30 30 /* 31 - * Definitions only for PFN swap entries (see is_pfn_swap_entry()). To 31 + * Definitions only for PFN swap entries (see leafeant_has_pfn()). To 32 32 * store PFN, we only need SWP_PFN_BITS bits. Each of the pfn swap entries 33 33 * can use the extra bits to store other information besides PFN. 34 34 */ ··· 65 65 66 66 #define SWP_MIG_YOUNG BIT(SWP_MIG_YOUNG_BIT) 67 67 #define SWP_MIG_DIRTY BIT(SWP_MIG_DIRTY_BIT) 68 - 69 - static inline bool is_pfn_swap_entry(swp_entry_t entry); 70 68 71 69 /* Clear all flags but only keep swp_entry_t related information */ 72 70 static inline pte_t pte_swp_clear_flags(pte_t pte) ··· 105 107 static inline pgoff_t swp_offset(swp_entry_t entry) 106 108 { 107 109 return entry.val & SWP_OFFSET_MASK; 108 - } 109 - 110 - /* 111 - * This should only be called upon a pfn swap entry to get the PFN stored 112 - * in the swap entry. Please refers to is_pfn_swap_entry() for definition 113 - * of pfn swap entry. 114 - */ 115 - static inline unsigned long swp_offset_pfn(swp_entry_t entry) 116 - { 117 - VM_BUG_ON(!is_pfn_swap_entry(entry)); 118 - return swp_offset(entry) & SWP_PFN_MASK; 119 110 } 120 111 121 112 /* ··· 156 169 return swp_entry(SWP_DEVICE_WRITE, offset); 157 170 } 158 171 159 - static inline bool is_device_private_entry(swp_entry_t entry) 160 - { 161 - int type = swp_type(entry); 162 - return type == SWP_DEVICE_READ || type == SWP_DEVICE_WRITE; 163 - } 164 - 165 - static inline bool is_writable_device_private_entry(swp_entry_t entry) 166 - { 167 - return unlikely(swp_type(entry) == SWP_DEVICE_WRITE); 168 - } 169 - 170 172 static inline swp_entry_t make_device_exclusive_entry(pgoff_t offset) 171 173 { 172 174 return swp_entry(SWP_DEVICE_EXCLUSIVE, offset); 173 - } 174 - 175 - static inline bool is_device_exclusive_entry(swp_entry_t entry) 176 - { 177 - return swp_type(entry) == SWP_DEVICE_EXCLUSIVE; 178 175 } 179 176 180 177 #else /* CONFIG_DEVICE_PRIVATE */ ··· 172 201 return swp_entry(0, 0); 173 202 } 174 203 175 - static inline bool is_device_private_entry(swp_entry_t entry) 176 - { 177 - return false; 178 - } 179 - 180 - static inline bool is_writable_device_private_entry(swp_entry_t entry) 181 - { 182 - return false; 183 - } 184 - 185 204 static inline swp_entry_t make_device_exclusive_entry(pgoff_t offset) 186 205 { 187 206 return swp_entry(0, 0); 188 207 } 189 208 190 - static inline bool is_device_exclusive_entry(swp_entry_t entry) 191 - { 192 - return false; 193 - } 194 - 195 209 #endif /* CONFIG_DEVICE_PRIVATE */ 196 210 197 211 #ifdef CONFIG_MIGRATION 198 - static inline int is_migration_entry(swp_entry_t entry) 199 - { 200 - return unlikely(swp_type(entry) == SWP_MIGRATION_READ || 201 - swp_type(entry) == SWP_MIGRATION_READ_EXCLUSIVE || 202 - swp_type(entry) == SWP_MIGRATION_WRITE); 203 - } 204 - 205 - static inline int is_writable_migration_entry(swp_entry_t entry) 206 - { 207 - return unlikely(swp_type(entry) == SWP_MIGRATION_WRITE); 208 - } 209 - 210 - static inline int is_readable_migration_entry(swp_entry_t entry) 211 - { 212 - return unlikely(swp_type(entry) == SWP_MIGRATION_READ); 213 - } 214 - 215 - static inline int is_readable_exclusive_migration_entry(swp_entry_t entry) 216 - { 217 - return unlikely(swp_type(entry) == SWP_MIGRATION_READ_EXCLUSIVE); 218 - } 219 212 220 213 static inline swp_entry_t make_readable_migration_entry(pgoff_t offset) 221 214 { ··· 245 310 return swp_entry(0, 0); 246 311 } 247 312 248 - static inline int is_migration_entry(swp_entry_t swp) 249 - { 250 - return 0; 251 - } 252 - 253 313 static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 254 314 unsigned long address) { } 255 315 static inline void migration_entry_wait_huge(struct vm_area_struct *vma, 256 316 unsigned long addr, pte_t *pte) { } 257 - static inline int is_writable_migration_entry(swp_entry_t entry) 258 - { 259 - return 0; 260 - } 261 - static inline int is_readable_migration_entry(swp_entry_t entry) 262 - { 263 - return 0; 264 - } 265 317 266 318 static inline swp_entry_t make_migration_entry_young(swp_entry_t entry) 267 319 { ··· 330 408 static inline swp_entry_t make_guard_swp_entry(void) 331 409 { 332 410 return make_pte_marker_entry(PTE_MARKER_GUARD); 333 - } 334 - 335 - static inline struct page *pfn_swap_entry_to_page(swp_entry_t entry) 336 - { 337 - struct page *p = pfn_to_page(swp_offset_pfn(entry)); 338 - 339 - /* 340 - * Any use of migration entries may only occur while the 341 - * corresponding page is locked 342 - */ 343 - BUG_ON(is_migration_entry(entry) && !PageLocked(p)); 344 - 345 - return p; 346 - } 347 - 348 - static inline struct folio *pfn_swap_entry_folio(swp_entry_t entry) 349 - { 350 - struct folio *folio = pfn_folio(swp_offset_pfn(entry)); 351 - 352 - /* 353 - * Any use of migration entries may only occur while the 354 - * corresponding folio is locked 355 - */ 356 - BUG_ON(is_migration_entry(entry) && !folio_test_locked(folio)); 357 - 358 - return folio; 359 - } 360 - 361 - /* 362 - * A pfn swap entry is a special type of swap entry that always has a pfn stored 363 - * in the swap offset. They can either be used to represent unaddressable device 364 - * memory, to restrict access to a page undergoing migration or to represent a 365 - * pfn which has been hwpoisoned and unmapped. 366 - */ 367 - static inline bool is_pfn_swap_entry(swp_entry_t entry) 368 - { 369 - /* Make sure the swp offset can always store the needed fields */ 370 - BUILD_BUG_ON(SWP_TYPE_SHIFT < SWP_PFN_BITS); 371 - 372 - return is_migration_entry(entry) || is_device_private_entry(entry) || 373 - is_device_exclusive_entry(entry) || is_hwpoison_entry(entry); 374 411 } 375 412 376 413 struct page_vma_mapped_walk;
+10 -10
mm/debug_vm_pgtable.c
··· 844 844 static void __init swap_migration_tests(struct pgtable_debug_args *args) 845 845 { 846 846 struct page *page; 847 - swp_entry_t swp; 847 + softleaf_t entry; 848 848 849 849 if (!IS_ENABLED(CONFIG_MIGRATION)) 850 850 return; ··· 867 867 * be locked, otherwise it stumbles upon a BUG_ON(). 868 868 */ 869 869 __SetPageLocked(page); 870 - swp = make_writable_migration_entry(page_to_pfn(page)); 871 - WARN_ON(!is_migration_entry(swp)); 872 - WARN_ON(!is_writable_migration_entry(swp)); 870 + entry = make_writable_migration_entry(page_to_pfn(page)); 871 + WARN_ON(!softleaf_is_migration(entry)); 872 + WARN_ON(!softleaf_is_migration_write(entry)); 873 873 874 - swp = make_readable_migration_entry(swp_offset(swp)); 875 - WARN_ON(!is_migration_entry(swp)); 876 - WARN_ON(is_writable_migration_entry(swp)); 874 + entry = make_readable_migration_entry(swp_offset(entry)); 875 + WARN_ON(!softleaf_is_migration(entry)); 876 + WARN_ON(softleaf_is_migration_write(entry)); 877 877 878 - swp = make_readable_migration_entry(page_to_pfn(page)); 879 - WARN_ON(!is_migration_entry(swp)); 880 - WARN_ON(is_writable_migration_entry(swp)); 878 + entry = make_readable_migration_entry(page_to_pfn(page)); 879 + WARN_ON(!softleaf_is_migration(entry)); 880 + WARN_ON(softleaf_is_migration_write(entry)); 881 881 __ClearPageLocked(page); 882 882 } 883 883
+1 -1
mm/hmm.c
··· 270 270 cpu_flags = HMM_PFN_VALID; 271 271 if (softleaf_is_device_private_write(entry)) 272 272 cpu_flags |= HMM_PFN_WRITE; 273 - new_pfn_flags = swp_offset_pfn(entry) | cpu_flags; 273 + new_pfn_flags = softleaf_to_pfn(entry) | cpu_flags; 274 274 goto out; 275 275 } 276 276
+1 -1
mm/hugetlb.c
··· 4934 4934 } else if (unlikely(softleaf_is_migration(softleaf))) { 4935 4935 bool uffd_wp = pte_swp_uffd_wp(entry); 4936 4936 4937 - if (!is_readable_migration_entry(softleaf) && cow) { 4937 + if (!softleaf_is_migration_read(softleaf) && cow) { 4938 4938 /* 4939 4939 * COW mappings require pages in both 4940 4940 * parent and child to be set to read.
+3 -3
mm/ksm.c
··· 632 632 if (pte_present(pte)) { 633 633 folio = vm_normal_folio(walk->vma, addr, pte); 634 634 } else if (!pte_none(pte)) { 635 - swp_entry_t entry = pte_to_swp_entry(pte); 635 + const softleaf_t entry = softleaf_from_pte(pte); 636 636 637 637 /* 638 638 * As KSM pages remain KSM pages until freed, no need to wait 639 639 * here for migration to end. 640 640 */ 641 - if (is_migration_entry(entry)) 642 - folio = pfn_swap_entry_folio(entry); 641 + if (softleaf_is_migration(entry)) 642 + folio = softleaf_to_folio(entry); 643 643 } 644 644 /* return 1 if the page is an normal ksm page or KSM-placed zero page */ 645 645 found = (folio && folio_test_ksm(folio)) ||
+3 -3
mm/memory-failure.c
··· 693 693 if (pte_present(pte)) { 694 694 pfn = pte_pfn(pte); 695 695 } else { 696 - swp_entry_t swp = pte_to_swp_entry(pte); 696 + const softleaf_t entry = softleaf_from_pte(pte); 697 697 698 - if (is_hwpoison_entry(swp)) 699 - pfn = swp_offset_pfn(swp); 698 + if (softleaf_is_hwpoison(entry)) 699 + pfn = softleaf_to_pfn(entry); 700 700 } 701 701 702 702 if (!pfn || pfn != poisoned_pfn)
+2 -1
mm/memory.c
··· 902 902 static int try_restore_exclusive_pte(struct vm_area_struct *vma, 903 903 unsigned long addr, pte_t *ptep, pte_t orig_pte) 904 904 { 905 - struct page *page = pfn_swap_entry_to_page(pte_to_swp_entry(orig_pte)); 905 + const softleaf_t entry = softleaf_from_pte(orig_pte); 906 + struct page *page = softleaf_to_page(entry); 906 907 struct folio *folio = page_folio(page); 907 908 908 909 if (folio_trylock(folio)) {
+3 -1
mm/mempolicy.c
··· 705 705 if (pte_none(ptent)) 706 706 continue; 707 707 if (!pte_present(ptent)) { 708 - if (is_migration_entry(pte_to_swp_entry(ptent))) 708 + const softleaf_t entry = softleaf_from_pte(ptent); 709 + 710 + if (softleaf_is_migration(entry)) 709 711 qp->nr_failed++; 710 712 continue; 711 713 }
+3 -3
mm/migrate.c
··· 483 483 spinlock_t *ptl; 484 484 pte_t *ptep; 485 485 pte_t pte; 486 - swp_entry_t entry; 486 + softleaf_t entry; 487 487 488 488 ptep = pte_offset_map_lock(mm, pmd, address, &ptl); 489 489 if (!ptep) ··· 495 495 if (pte_none(pte) || pte_present(pte)) 496 496 goto out; 497 497 498 - entry = pte_to_swp_entry(pte); 499 - if (!is_migration_entry(entry)) 498 + entry = softleaf_from_pte(pte); 499 + if (!softleaf_is_migration(entry)) 500 500 goto out; 501 501 502 502 migration_entry_wait_on_locked(entry, ptl);
+5 -5
mm/migrate_device.c
··· 279 279 unsigned long mpfn = 0, pfn; 280 280 struct folio *folio; 281 281 struct page *page; 282 - swp_entry_t entry; 282 + softleaf_t entry; 283 283 pte_t pte; 284 284 285 285 pte = ptep_get(ptep); ··· 298 298 * page table entry. Other special swap entries are not 299 299 * migratable, and we ignore regular swapped page. 300 300 */ 301 - entry = pte_to_swp_entry(pte); 302 - if (!is_device_private_entry(entry)) 301 + entry = softleaf_from_pte(pte); 302 + if (!softleaf_is_device_private(entry)) 303 303 goto next; 304 304 305 - page = pfn_swap_entry_to_page(entry); 305 + page = softleaf_to_page(entry); 306 306 pgmap = page_pgmap(page); 307 307 if (!(migrate->flags & 308 308 MIGRATE_VMA_SELECT_DEVICE_PRIVATE) || ··· 330 330 331 331 mpfn = migrate_pfn(page_to_pfn(page)) | 332 332 MIGRATE_PFN_MIGRATE; 333 - if (is_writable_device_private_entry(entry)) 333 + if (softleaf_is_device_private_write(entry)) 334 334 mpfn |= MIGRATE_PFN_WRITE; 335 335 } else { 336 336 pfn = pte_pfn(pte);
+4 -4
mm/mprotect.c
··· 317 317 pages++; 318 318 } 319 319 } else { 320 - swp_entry_t entry = pte_to_swp_entry(oldpte); 320 + softleaf_t entry = softleaf_from_pte(oldpte); 321 321 pte_t newpte; 322 322 323 - if (is_writable_migration_entry(entry)) { 324 - struct folio *folio = pfn_swap_entry_folio(entry); 323 + if (softleaf_is_migration_write(entry)) { 324 + const struct folio *folio = softleaf_to_folio(entry); 325 325 326 326 /* 327 327 * A protection check is difficult so ··· 335 335 newpte = swp_entry_to_pte(entry); 336 336 if (pte_swp_soft_dirty(oldpte)) 337 337 newpte = pte_swp_mksoft_dirty(newpte); 338 - } else if (is_writable_device_private_entry(entry)) { 338 + } else if (softleaf_is_device_private_write(entry)) { 339 339 /* 340 340 * We do not preserve soft-dirtiness. See 341 341 * copy_nonpresent_pte() for explanation.
+4 -4
mm/page_vma_mapped.c
··· 49 49 if (is_migration) 50 50 return false; 51 51 } else if (!is_migration) { 52 - swp_entry_t entry; 52 + softleaf_t entry; 53 53 54 54 /* 55 55 * Handle un-addressable ZONE_DEVICE memory. ··· 67 67 * For more details on device private memory see HMM 68 68 * (include/linux/hmm.h or mm/hmm.c). 69 69 */ 70 - entry = pte_to_swp_entry(ptent); 71 - if (!is_device_private_entry(entry) && 72 - !is_device_exclusive_entry(entry)) 70 + entry = softleaf_from_pte(ptent); 71 + if (!softleaf_is_device_private(entry) && 72 + !softleaf_is_device_exclusive(entry)) 73 73 return false; 74 74 } 75 75 spin_lock(*ptlp);
+3 -4
mm/pagewalk.c
··· 1007 1007 goto found; 1008 1008 } 1009 1009 } else if (!pte_none(pte)) { 1010 - swp_entry_t entry = pte_to_swp_entry(pte); 1010 + const softleaf_t entry = softleaf_from_pte(pte); 1011 1011 1012 - if ((flags & FW_MIGRATION) && 1013 - is_migration_entry(entry)) { 1014 - page = pfn_swap_entry_to_page(entry); 1012 + if ((flags & FW_MIGRATION) && softleaf_is_migration(entry)) { 1013 + page = softleaf_to_page(entry); 1015 1014 expose_page = false; 1016 1015 goto found; 1017 1016 }
+6 -3
mm/rmap.c
··· 1969 1969 if (likely(pte_present(pteval))) { 1970 1970 pfn = pte_pfn(pteval); 1971 1971 } else { 1972 - pfn = swp_offset_pfn(pte_to_swp_entry(pteval)); 1972 + pfn = softleaf_to_pfn(pte_to_swp_entry(pteval)); 1973 1973 VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio); 1974 1974 } 1975 1975 ··· 2368 2368 if (likely(pte_present(pteval))) { 2369 2369 pfn = pte_pfn(pteval); 2370 2370 } else { 2371 - pfn = swp_offset_pfn(pte_to_swp_entry(pteval)); 2371 + pfn = softleaf_to_pfn(pte_to_swp_entry(pteval)); 2372 2372 VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio); 2373 2373 } 2374 2374 ··· 2453 2453 folio_mark_dirty(folio); 2454 2454 writable = pte_write(pteval); 2455 2455 } else { 2456 + const softleaf_t entry = softleaf_from_pte(pteval); 2457 + 2456 2458 pte_clear(mm, address, pvmw.pte); 2457 - writable = is_writable_device_private_entry(pte_to_swp_entry(pteval)); 2459 + 2460 + writable = softleaf_is_device_private_write(entry); 2458 2461 } 2459 2462 2460 2463 VM_WARN_ON_FOLIO(writable && folio_test_anon(folio) &&