Re: [PATCH 1/3] mm: correct return value of migrate_pages()
From: Michal Nazarewicz
Date: Mon Jul 16 2012 - 13:40:27 EST
Joonsoo Kim <js1304@xxxxxxxxx> writes:
> migrate_pages() should return number of pages not migrated or error code.
> When unmap_and_move return -EAGAIN, outer loop is re-execution without
> initialising nr_failed. This makes nr_failed over-counted.
>
> So this patch correct it by initialising nr_failed in outer loop.
>
> Signed-off-by: Joonsoo Kim <js1304@xxxxxxxxx>
> Cc: Christoph Lameter <cl@xxxxxxxxx>
Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
Actually, it makes me wonder if there is any code that uses this
information. If not, it would be best in my opinion to make it return
zero or negative error code, but that would have to be checked.
> diff --git a/mm/migrate.c b/mm/migrate.c
> index be26d5c..294d52a 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -982,6 +982,7 @@ int migrate_pages(struct list_head *from,
>
> for(pass = 0; pass < 10 && retry; pass++) {
> retry = 0;
> + nr_failed = 0;
>
> list_for_each_entry_safe(page, page2, from, lru) {
> cond_resched();
--
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--
Attachment:
pgp00000.pgp
Description: PGP signature