The patch titled Subject: mm: migrate: remove isolated variable in add_page_for_migration() has been added to the -mm mm-unstable branch. Its filename is mm-migrate-remove-isolated-variable-in-add_page_for_migration.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-migrate-remove-isolated-variable-in-add_page_for_migration.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Subject: mm: migrate: remove isolated variable in add_page_for_migration() Date: Wed, 13 Sep 2023 17:51:31 +0800 Directly check the return of isolate_hugetlb() and folio_isolate_lru() to remove isolated variable, also setup err = -EBUSY in advance before isolation, and update err only when successfully queued for migration, which could help us to unify and simplify code a bit. Link: https://lkml.kernel.org/r/20230913095131.2426871-9-wangkefeng.wang@xxxxxxxxxx Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/mm/migrate.c~mm-migrate-remove-isolated-variable-in-add_page_for_migration +++ a/mm/migrate.c @@ -2059,7 +2059,6 @@ static int add_page_for_migration(struct struct page *page; struct folio *folio; int err; - bool isolated; mmap_read_lock(mm); addr = (unsigned long)untagged_addr_remote(mm, p); @@ -2092,15 +2091,13 @@ static int add_page_for_migration(struct if (page_mapcount(page) > 1 && !migrate_all) goto out_putfolio; + err = -EBUSY; if (folio_test_hugetlb(folio)) { - isolated = isolate_hugetlb(folio, pagelist); - err = isolated ? 1 : -EBUSY; + if (isolate_hugetlb(folio, pagelist)) + err = 1; } else { - isolated = folio_isolate_lru(folio); - if (!isolated) { - err = -EBUSY; + if (!folio_isolate_lru(folio)) goto out_putfolio; - } err = 1; list_add_tail(&folio->lru, pagelist); _ Patches currently in -mm which might be from wangkefeng.wang@xxxxxxxxxx are mm-migrate-remove-pagetranshuge-check-in-numamigrate_isolate_page.patch mm-migrate-remove-thp-mapcount-check-in-numamigrate_isolate_page.patch mm-migrate-convert-numamigrate_isolate_page-to-numamigrate_isolate_folio.patch mm-migrate-convert-migrate_misplaced_page-to-migrate_misplaced_folio.patch mm-migrate-use-__folio_test_movable.patch mm-migrate-use-a-folio-in-add_page_for_migration.patch mm-migrate-remove-pagehead-check-for-hugetlb-in-add_page_for_migration.patch mm-migrate-remove-isolated-variable-in-add_page_for_migration.patch