The patch titled Subject: mm: fix do_pages_move status handling has been added to the -mm tree. Its filename is mm-fix-do_pages_move-status-handling.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-fix-do_pages_move-status-handling.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-fix-do_pages_move-status-handling.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: Michal Hocko <mhocko@xxxxxxxx> Subject: mm: fix do_pages_move status handling Li Wang has reported that LTP move_pages04 test fails with the current tree: LTP move_pages04: TFAIL : move_pages04.c:143: status[1] is EPERM, expected EFAULT The test allocates an array of two pages, one is present while the other is not (resp. backed by zero page) and it expects EFAULT for the second page as the man page suggests. We are reporting EPERM which doesn't make any sense and this is a result of a bug from cf5f16b23ec9 ("mm: unclutter THP migration"). do_pages_move tries to handle as many pages in one batch as possible so we queue all pages with the same node target together and that corresponds to [start, i] range which is then used to update status array. add_page_for_migration will correctly notice the zero (resp. !present) page and returns with EFAULT which gets written to the status. But if this is the last page in the array we do not update start and so the last store_status after the loop will overwrite the range of the last batch with NUMA_NO_NODE (which corresponds to EPERM). Fix this by simply bailing out from the last flush if the pagelist is empty as there is clearly nothing more to do. Link: http://lkml.kernel.org/r/20180418121255.334-1-mhocko@xxxxxxxxxx Fixes: cf5f16b23ec9 ("mm: unclutter THP migration") Signed-off-by: Michal Hocko <mhocko@xxxxxxxx> Reported-by: Li Wang <liwang@xxxxxxxxxx> Tested-by: Li Wang <liwang@xxxxxxxxxx> Cc: Zi Yan <zi.yan@xxxxxxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN mm/migrate.c~mm-fix-do_pages_move-status-handling mm/migrate.c --- a/mm/migrate.c~mm-fix-do_pages_move-status-handling +++ a/mm/migrate.c @@ -1622,6 +1622,9 @@ static int do_pages_move(struct mm_struc current_node = NUMA_NO_NODE; } out_flush: + if (list_empty(&pagelist)) + return err; + /* Make sure we do not overwrite the existing error */ err1 = do_move_pages_to_node(mm, &pagelist, current_node); if (!err1) _ Patches currently in -mm which might be from mhocko@xxxxxxxx are mm-fix-do_pages_move-status-handling.patch mm-oom-docs-describe-the-cgroup-aware-oom-killer-fix-2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html