[PATCH] mm: move_pages: fix the return value if there are not-migrated pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The do_move_pages_to_node() might return > 0 value, the number of pages
that are not migrated, then the value will be returned to userspace
directly.  But, move_pages() syscall would just return 0 or errno.  So,
we need reset the return value to 0 for such case as what pre-v4.17 did.

Fixes: a49bd4d71637 ("mm, numa: rework do_pages_move")
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>    [4.17+]
Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx>
---
 mm/migrate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 86873b6..3e75432 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1659,8 +1659,11 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
 			goto out_flush;
 
 		err = do_move_pages_to_node(mm, &pagelist, current_node);
-		if (err)
+		if (err) {
+			if (err > 0)
+				err = 0;
 			goto out;
+		}
 		if (i > start) {
 			err = store_status(status, start, current_node, i - start);
 			if (err)
-- 
1.8.3.1




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux