The patch titled Subject: migrate_pages(): remove unnecessary list_safe_reset_next() has been added to the -mm mm-unstable branch. Its filename is migrate_pages-remove-unnecessary-list_safe_reset_next.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/migrate_pages-remove-unnecessary-list_safe_reset_next.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: Huang Ying <ying.huang@xxxxxxxxx> Subject: migrate_pages(): remove unnecessary list_safe_reset_next() Date: Wed, 17 Aug 2022 16:14:02 +0800 Before commit b5bade978e9b ("mm: migrate: fix the return value of migrate_pages()"), the tail pages of THP will be put in the "from" list directly. So one of the loop cursors (page2) needs to be reset, as is done in try_split_thp() via list_safe_reset_next(). But after the commit, the tail pages of THP will be put in a dedicated list (thp_split_pages). That is, the "from" list will not be changed during splitting. So, it's unnecessary to call list_safe_reset_next() anymore. This is a code cleanup, no functionality changes are expected. Link: https://lkml.kernel.org/r/20220817081408.513338-3-ying.huang@xxxxxxxxx Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx> Cc: Zi Yan <ziy@xxxxxxxxxx> Cc: Yang Shi <shy828301@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/mm/migrate.c~migrate_pages-remove-unnecessary-list_safe_reset_next +++ a/mm/migrate.c @@ -1369,16 +1369,13 @@ out: return rc; } -static inline int try_split_thp(struct page *page, struct page **page2, - struct list_head *from) +static inline int try_split_thp(struct page *page, struct list_head *split_pages) { - int rc = 0; + int rc; lock_page(page); - rc = split_huge_page_to_list(page, from); + rc = split_huge_page_to_list(page, split_pages); unlock_page(page); - if (!rc) - list_safe_reset_next(page, *page2, lru); return rc; } @@ -1482,7 +1479,7 @@ retry: /* THP migration is unsupported */ if (is_thp) { nr_thp_failed++; - if (!try_split_thp(page, &page2, &thp_split_pages)) { + if (!try_split_thp(page, &thp_split_pages)) { nr_thp_split++; goto retry; } @@ -1501,7 +1498,7 @@ retry: */ if (is_thp && !nosplit) { nr_thp_failed++; - if (!try_split_thp(page, &page2, &thp_split_pages)) { + if (!try_split_thp(page, &thp_split_pages)) { nr_thp_split++; goto retry; } _ Patches currently in -mm which might be from ying.huang@xxxxxxxxx are memory-tiering-hot-page-selection-with-hint-page-fault-latency.patch memory-tiering-rate-limit-numa-migration-throughput.patch memory-tiering-adjust-hot-threshold-automatically.patch migrate-fix-syscall-move_pages-return-value-for-failure.patch migrate_pages-remove-unnecessary-list_safe_reset_next.patch migrate_pages-fix-thp-failure-counting-for-enomem.patch migrate_pages-fix-failure-counting-for-thp-subpages-retrying.patch migrate_pages-fix-failure-counting-for-thp-on-enosys.patch migrate_pages-fix-failure-counting-for-thp-splitting.patch migrate_pages-fix-failure-counting-for-retry.patch