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.

treewide: remove MIGRATEPAGE_SUCCESS

At this point MIGRATEPAGE_SUCCESS is misnamed for all folio users,
and now that we remove MIGRATEPAGE_UNMAP, it's really the only "success"
return value that the code uses and expects.

Let's just get rid of MIGRATEPAGE_SUCCESS completely and just use "0"
for success.

Link: https://lkml.kernel.org/r/20250811143949.1117439-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com> [mm]
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com> [jfs]
Acked-by: David Sterba <dsterba@suse.com> [btrfs]
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Byungchul Park <byungchul@sk.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Chris Mason <clm@fb.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: Eugenio Pé rez <eperezma@redhat.com>
Cc: Gregory Price <gourry@gourry.net>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
fb49a442 95c2908f

+36 -46
+1 -1
arch/powerpc/platforms/pseries/cmm.c
··· 545 545 /* balloon page list reference */ 546 546 put_page(page); 547 547 548 - return MIGRATEPAGE_SUCCESS; 548 + return 0; 549 549 } 550 550 551 551 static void cmm_balloon_compaction_init(void)
+2 -2
drivers/misc/vmw_balloon.c
··· 1806 1806 * the list after acquiring the lock. 1807 1807 */ 1808 1808 get_page(newpage); 1809 - ret = MIGRATEPAGE_SUCCESS; 1809 + ret = 0; 1810 1810 } 1811 1811 1812 1812 /* Update the balloon list under the @pages_lock */ ··· 1817 1817 * If we succeed just insert it to the list and update the statistics 1818 1818 * under the lock. 1819 1819 */ 1820 - if (ret == MIGRATEPAGE_SUCCESS) { 1820 + if (!ret) { 1821 1821 balloon_page_insert(&b->b_dev_info, newpage); 1822 1822 __count_vm_event(BALLOON_MIGRATE); 1823 1823 }
+1 -1
drivers/virtio/virtio_balloon.c
··· 875 875 balloon_page_finalize(page); 876 876 put_page(page); /* balloon reference */ 877 877 878 - return MIGRATEPAGE_SUCCESS; 878 + return 0; 879 879 } 880 880 #endif /* CONFIG_BALLOON_COMPACTION */ 881 881
+1 -1
fs/aio.c
··· 445 445 folio_get(dst); 446 446 447 447 rc = folio_migrate_mapping(mapping, dst, src, 1); 448 - if (rc != MIGRATEPAGE_SUCCESS) { 448 + if (rc) { 449 449 folio_put(dst); 450 450 goto out_unlock; 451 451 }
+2 -2
fs/btrfs/inode.c
··· 7421 7421 { 7422 7422 int ret = filemap_migrate_folio(mapping, dst, src, mode); 7423 7423 7424 - if (ret != MIGRATEPAGE_SUCCESS) 7424 + if (ret) 7425 7425 return ret; 7426 7426 7427 7427 if (folio_test_ordered(src)) { ··· 7429 7429 folio_set_ordered(dst); 7430 7430 } 7431 7431 7432 - return MIGRATEPAGE_SUCCESS; 7432 + return 0; 7433 7433 } 7434 7434 #else 7435 7435 #define btrfs_migrate_folio NULL
+2 -2
fs/hugetlbfs/inode.c
··· 1052 1052 int rc; 1053 1053 1054 1054 rc = migrate_huge_page_move_mapping(mapping, dst, src); 1055 - if (rc != MIGRATEPAGE_SUCCESS) 1055 + if (rc) 1056 1056 return rc; 1057 1057 1058 1058 if (hugetlb_folio_subpool(src)) { ··· 1063 1063 1064 1064 folio_migrate_flags(dst, src); 1065 1065 1066 - return MIGRATEPAGE_SUCCESS; 1066 + return 0; 1067 1067 } 1068 1068 #else 1069 1069 #define hugetlbfs_migrate_folio NULL
+4 -4
fs/jfs/jfs_metapage.c
··· 169 169 } 170 170 171 171 rc = filemap_migrate_folio(mapping, dst, src, mode); 172 - if (rc != MIGRATEPAGE_SUCCESS) 172 + if (rc) 173 173 return rc; 174 174 175 175 for (i = 0; i < MPS_PER_PAGE; i++) { ··· 199 199 } 200 200 } 201 201 202 - return MIGRATEPAGE_SUCCESS; 202 + return 0; 203 203 } 204 204 #endif /* CONFIG_MIGRATION */ 205 205 ··· 242 242 return -EAGAIN; 243 243 244 244 rc = filemap_migrate_folio(mapping, dst, src, mode); 245 - if (rc != MIGRATEPAGE_SUCCESS) 245 + if (rc) 246 246 return rc; 247 247 248 248 if (unlikely(insert_metapage(dst, mp))) ··· 253 253 mp->folio = dst; 254 254 remove_metapage(src, mp); 255 255 256 - return MIGRATEPAGE_SUCCESS; 256 + return 0; 257 257 } 258 258 #endif /* CONFIG_MIGRATION */ 259 259
+1 -9
include/linux/migrate.h
··· 12 12 13 13 struct migration_target_control; 14 14 15 - /* 16 - * Return values from addresss_space_operations.migratepage(): 17 - * - negative errno on page migration failure; 18 - * - zero on page migration success; 19 - */ 20 - #define MIGRATEPAGE_SUCCESS 0 21 - 22 15 /** 23 16 * struct movable_operations - Driver page migration 24 17 * @isolate_page: ··· 27 34 * @src page. The driver should copy the contents of the 28 35 * @src page to the @dst page and set up the fields of @dst page. 29 36 * Both pages are locked. 30 - * If page migration is successful, the driver should 31 - * return MIGRATEPAGE_SUCCESS. 37 + * If page migration is successful, the driver should return 0. 32 38 * If the driver cannot migrate the page at the moment, it can return 33 39 * -EAGAIN. The VM interprets this as a temporary migration failure and 34 40 * will retry it later. Any other error value is a permanent migration
+19 -21
mm/migrate.c
··· 231 231 * src and dst are also released by migration core. These pages will not be 232 232 * folios in the future, so that must be reworked. 233 233 * 234 - * Returns MIGRATEPAGE_SUCCESS on success, otherwise a negative error 235 - * code. 234 + * Returns 0 on success, otherwise a negative error code. 236 235 */ 237 236 static int migrate_movable_ops_page(struct page *dst, struct page *src, 238 237 enum migrate_mode mode) 239 238 { 240 - int rc = MIGRATEPAGE_SUCCESS; 239 + int rc; 241 240 242 241 VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(src), src); 243 242 VM_WARN_ON_ONCE_PAGE(!PageMovableOpsIsolated(src), src); 244 243 rc = page_movable_ops(src)->migrate_page(dst, src, mode); 245 - if (rc == MIGRATEPAGE_SUCCESS) 244 + if (!rc) 246 245 ClearPageMovableOpsIsolated(src); 247 246 return rc; 248 247 } ··· 586 587 if (folio_test_swapbacked(folio)) 587 588 __folio_set_swapbacked(newfolio); 588 589 589 - return MIGRATEPAGE_SUCCESS; 590 + return 0; 590 591 } 591 592 592 593 oldzone = folio_zone(folio); ··· 687 688 } 688 689 local_irq_enable(); 689 690 690 - return MIGRATEPAGE_SUCCESS; 691 + return 0; 691 692 } 692 693 693 694 int folio_migrate_mapping(struct address_space *mapping, ··· 736 737 737 738 xas_unlock_irq(&xas); 738 739 739 - return MIGRATEPAGE_SUCCESS; 740 + return 0; 740 741 } 741 742 742 743 /* ··· 852 853 return rc; 853 854 854 855 rc = __folio_migrate_mapping(mapping, dst, src, expected_count); 855 - if (rc != MIGRATEPAGE_SUCCESS) 856 + if (rc) 856 857 return rc; 857 858 858 859 if (src_private) 859 860 folio_attach_private(dst, folio_detach_private(src)); 860 861 861 862 folio_migrate_flags(dst, src); 862 - return MIGRATEPAGE_SUCCESS; 863 + return 0; 863 864 } 864 865 865 866 /** ··· 966 967 } 967 968 968 969 rc = filemap_migrate_folio(mapping, dst, src, mode); 969 - if (rc != MIGRATEPAGE_SUCCESS) 970 + if (rc) 970 971 goto unlock_buffers; 971 972 972 973 bh = head; ··· 1070 1071 * 1071 1072 * Return value: 1072 1073 * < 0 - error code 1073 - * MIGRATEPAGE_SUCCESS - success 1074 + * 0 - success 1074 1075 */ 1075 1076 static int move_to_new_folio(struct folio *dst, struct folio *src, 1076 1077 enum migrate_mode mode) ··· 1098 1099 else 1099 1100 rc = fallback_migrate_folio(mapping, dst, src, mode); 1100 1101 1101 - if (rc == MIGRATEPAGE_SUCCESS) { 1102 + if (!rc) { 1102 1103 /* 1103 1104 * For pagecache folios, src->mapping must be cleared before src 1104 1105 * is freed. Anonymous folios must stay anonymous until freed. ··· 1448 1449 if (folio_ref_count(src) == 1) { 1449 1450 /* page was freed from under us. So we are done. */ 1450 1451 folio_putback_hugetlb(src); 1451 - return MIGRATEPAGE_SUCCESS; 1452 + return 0; 1452 1453 } 1453 1454 1454 1455 dst = get_new_folio(src, private); ··· 1511 1512 rc = move_to_new_folio(dst, src, mode); 1512 1513 1513 1514 if (page_was_mapped) 1514 - remove_migration_ptes(src, 1515 - rc == MIGRATEPAGE_SUCCESS ? dst : src, 0); 1515 + remove_migration_ptes(src, !rc ? dst : src, 0); 1516 1516 1517 1517 unlock_put_anon: 1518 1518 folio_unlock(dst); ··· 1520 1522 if (anon_vma) 1521 1523 put_anon_vma(anon_vma); 1522 1524 1523 - if (rc == MIGRATEPAGE_SUCCESS) { 1525 + if (!rc) { 1524 1526 move_hugetlb_state(src, dst, reason); 1525 1527 put_new_folio = NULL; 1526 1528 } ··· 1528 1530 out_unlock: 1529 1531 folio_unlock(src); 1530 1532 out: 1531 - if (rc == MIGRATEPAGE_SUCCESS) 1533 + if (!rc) 1532 1534 folio_putback_hugetlb(src); 1533 1535 else if (rc != -EAGAIN) 1534 1536 list_move_tail(&src->lru, ret); ··· 1638 1640 reason, ret_folios); 1639 1641 /* 1640 1642 * The rules are: 1641 - * Success: hugetlb folio will be put back 1643 + * 0: hugetlb folio will be put back 1642 1644 * -EAGAIN: stay on the from list 1643 1645 * -ENOMEM: stay on the from list 1644 1646 * Other errno: put on ret_folios list ··· 1655 1657 retry++; 1656 1658 nr_retry_pages += nr_pages; 1657 1659 break; 1658 - case MIGRATEPAGE_SUCCESS: 1660 + case 0: 1659 1661 stats->nr_succeeded += nr_pages; 1660 1662 break; 1661 1663 default: ··· 1709 1711 reason, ret_folios); 1710 1712 /* 1711 1713 * The rules are: 1712 - * Success: folio will be freed 1714 + * 0: folio will be freed 1713 1715 * -EAGAIN: stay on the unmap_folios list 1714 1716 * Other errno: put on ret_folios list 1715 1717 */ ··· 1719 1721 *thp_retry += is_thp; 1720 1722 *nr_retry_pages += nr_pages; 1721 1723 break; 1722 - case MIGRATEPAGE_SUCCESS: 1724 + case 0: 1723 1725 stats->nr_succeeded += nr_pages; 1724 1726 stats->nr_thp_succeeded += is_thp; 1725 1727 break;
+1 -1
mm/migrate_device.c
··· 778 778 if (migrate && migrate->fault_page == page) 779 779 extra_cnt = 1; 780 780 r = folio_migrate_mapping(mapping, newfolio, folio, extra_cnt); 781 - if (r != MIGRATEPAGE_SUCCESS) 781 + if (r) 782 782 src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; 783 783 else 784 784 folio_migrate_flags(newfolio, folio);
+2 -2
mm/zsmalloc.c
··· 1746 1746 * instead. 1747 1747 */ 1748 1748 if (!zpdesc->zspage) 1749 - return MIGRATEPAGE_SUCCESS; 1749 + return 0; 1750 1750 1751 1751 /* The page is locked, so this pointer must remain valid */ 1752 1752 zspage = get_zspage(zpdesc); ··· 1813 1813 reset_zpdesc(zpdesc); 1814 1814 zpdesc_put(zpdesc); 1815 1815 1816 - return MIGRATEPAGE_SUCCESS; 1816 + return 0; 1817 1817 } 1818 1818 1819 1819 static void zs_page_putback(struct page *page)