From: David Rientjes <rientjes@xxxxxxxxxx> Subject: mm, migrate: increment fail count on ENOMEM If page migration fails due to -ENOMEM, nr_failed should still be incremented for proper statistics. This was encountered recently when all page migration vmstats showed 0, and inferred that migrate_pages() was never called, although in reality the first page migration failed because compaction_alloc() failed to find a migration target. This patch increments nr_failed so the vmstat is properly accounted on ENOMEM. Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1605191510230.32658@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 1 + 1 file changed, 1 insertion(+) diff -puN mm/migrate.c~mm-migrate-increment-fail-count-on-enomem mm/migrate.c --- a/mm/migrate.c~mm-migrate-increment-fail-count-on-enomem +++ a/mm/migrate.c @@ -1171,6 +1171,7 @@ int migrate_pages(struct list_head *from switch(rc) { case -ENOMEM: + nr_failed++; goto out; case -EAGAIN: retry++; _ -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html