mm, migrate: increment fail count on ENOMEM
authorDavid Rientjes <[email protected]>
Fri, 20 May 2016 23:59:05 +0000 (16:59 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 May 2016 00:58:30 +0000 (17:58 -0700)
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/[email protected]
Signed-off-by: David Rientjes <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/migrate.c

index 53ab6398e7a2a2d3f122db43f0c36fbf62e562f2..9baf41c877ffb98595aac0834b8aa43aedd6dc76 100644 (file)
@@ -1171,6 +1171,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 
                        switch(rc) {
                        case -ENOMEM:
+                               nr_failed++;
                                goto out;
                        case -EAGAIN:
                                retry++;