[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1342528415-2291-2-git-send-email-js1304@gmail.com>
Date: Tue, 17 Jul 2012 21:33:33 +0900
From: Joonsoo Kim <js1304@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Joonsoo Kim <js1304@...il.com>,
Sasha Levin <levinsasha928@...il.com>,
Christoph Lameter <cl@...ux.com>
Subject: [PATCH 2/4 v2] mm: fix possible incorrect return value of migrate_pages() syscall
do_migrate_pages() can return the number of pages not migrated.
Because migrate_pages() syscall return this value directly,
migrate_pages() syscall may return the number of pages not migrated.
In fail case in migrate_pages() syscall, we should return error value.
So change err to -EBUSY
Additionally, Correct comment above do_migrate_pages()
Signed-off-by: Joonsoo Kim <js1304@...il.com>
Cc: Sasha Levin <levinsasha928@...il.com>
Cc: Christoph Lameter <cl@...ux.com>
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1d771e4..0732729 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -948,7 +948,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
* Move pages between the two nodesets so as to preserve the physical
* layout as much as possible.
*
- * Returns the number of page that could not be moved.
+ * Returns error or the number of pages not migrated.
*/
int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
const nodemask_t *to, int flags)
@@ -1382,6 +1382,8 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
err = do_migrate_pages(mm, old, new,
capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
+ if (err > 0)
+ err = -EBUSY;
mmput(mm);
out:
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists