linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm, thp: abort compaction if migration page cannot be charged to memcg
@ 2012-06-21  6:52 David Rientjes
  2012-06-21  8:11 ` Minchan Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David Rientjes @ 2012-06-21  6:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, KAMEZAWA Hiroyuki, Rik van Riel, Minchan Kim,
	linux-kernel, linux-mm

If page migration cannot charge the new page to the memcg,
migrate_pages() will return -ENOMEM.  This isn't considered in memory
compaction however, and the loop continues to iterate over all pageblocks
trying in a futile attempt to continue migrations which are only bound to
fail.

This will short circuit and fail memory compaction if migrate_pages()
returns -ENOMEM.  COMPACT_PARTIAL is returned in case some migrations
were successful so that the page allocator will retry.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/compaction.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -701,8 +701,11 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
 		if (err) {
 			putback_lru_pages(&cc->migratepages);
 			cc->nr_migratepages = 0;
+			if (err == -ENOMEM) {
+				ret = COMPACT_PARTIAL;
+				goto out;
+			}
 		}
-
 	}
 
 out:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-06-26  3:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21  6:52 [patch] mm, thp: abort compaction if migration page cannot be charged to memcg David Rientjes
2012-06-21  8:11 ` Minchan Kim
2012-06-21  8:30   ` David Rientjes
2012-06-21  9:01     ` David Rientjes
2012-06-21 10:05       ` Kamezawa Hiroyuki
2012-06-21 10:16         ` David Rientjes
2012-06-21  9:32 ` Mel Gorman
2012-06-21  9:57   ` David Rientjes
2012-06-25 20:40 ` Rik van Riel
2012-06-26  0:32   ` David Rientjes
2012-06-26  3:11     ` Kamezawa Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox