@@ -1665,18 +1665,18 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
err = add_page_for_migration(mm, addr, current_node,
&pagelist, flags & MPOL_MF_MOVE_ALL);
- if (!err) {
- /* The page is already on the target node */
- err = store_status(status, i, current_node, 1);
- if (err)
- goto out_flush;
- continue;
- } else if (err > 0) {
+ if (err > 0) {
/* The page is successfully queued for migration */
continue;
}
- err = store_status(status, i, err, 1);
+ /*
+ * Two possible cases for err here:
+ * == 0: page is already on the target node, then store
+ * current_node to status
+ * < 0: failed to add page to list, then store err to status
+ */
+ err = store_status(status, i, err ? : current_node, 1);
if (err)
goto out_flush;