From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx166.postini.com [74.125.245.166]) by kanga.kvack.org (Postfix) with SMTP id 638C56B005D for ; Fri, 27 Jul 2012 13:57:01 -0400 (EDT) Received: by mail-pb0-f41.google.com with SMTP id rp2so6139790pbb.14 for ; Fri, 27 Jul 2012 10:57:00 -0700 (PDT) From: Joonsoo Kim Subject: [RESEND PATCH 2/4 v3] mm: fix possible incorrect return value of migrate_pages() syscall Date: Sat, 28 Jul 2012 02:55:01 +0900 Message-Id: <1343411703-2720-2-git-send-email-js1304@gmail.com> In-Reply-To: <1343411703-2720-1-git-send-email-js1304@gmail.com> References: <1343411703-2720-1-git-send-email-js1304@gmail.com> Sender: owner-linux-mm@kvack.org List-ID: To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Joonsoo Kim , Sasha Levin , Christoph Lameter 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 Cc: Sasha Levin Cc: Christoph Lameter Acked-by: Michal Nazarewicz 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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org