Skip to content

Commit

Permalink
mm, migrate: increment fail count on ENOMEM
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rientjes authored and torvalds committed May 21, 2016
1 parent 6cd9dc3 commit dfef2ef
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit dfef2ef

Please sign in to comment.