[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87394rr4dl.fsf@erwin.mina86.com>
Date: Mon, 16 Jul 2012 19:40:38 +0200
From: Michal Nazarewicz <mina86@...n.pl>
To: Joonsoo Kim <js1304@...il.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Sasha Levin <levinsasha928@...il.com>,
Christoph Lameter <cl@...ux.com>
Subject: Re: [PATCH 2/3] mm: fix possible incorrect return value of migrate_pages() syscall
Joonsoo Kim <js1304@...il.com> writes:
> 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 -EIO
>
> 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>
Acked-by: Michal Nazarewicz <mina86@...a86.com>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 1d771e4..f7df271 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 = -EIO;
>
> mmput(mm);
> out:
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-<mina86-mina86.com>-<jid:mina86-jabber.org>--ooO--(_)--Ooo--
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists