summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-11-27 14:03:05 +0000
committerMel Gorman <mgorman@suse.de>2012-12-11 14:42:42 +0000
commit149c33e1c98f83050870514f380902dc6d617bd5 (patch)
tree5aaf7433c2de5f3176880835013049ccfbe7af73 /mm
parent7039e1dbec6eeaa8ecab43a82d6589eeced995c3 (diff)
downloadlinux-149c33e1c98f83050870514f380902dc6d617bd5.tar.bz2
mm: migrate: Drop the misplaced pages reference count if the target node is full
If we have to avoid migrating to a node that is nearly full, put page and return zero. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm')
-rw-r--r--mm/migrate.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index d168aec98427..c7d550011a64 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1489,18 +1489,21 @@ int migrate_misplaced_page(struct page *page, int node)
}
isolated = 1;
- /*
- * Page is isolated which takes a reference count so now the
- * callers reference can be safely dropped without the page
- * disappearing underneath us during migration
- */
- put_page(page);
-
page_lru = page_is_file_cache(page);
inc_zone_page_state(page, NR_ISOLATED_ANON + page_lru);
list_add(&page->lru, &migratepages);
}
+ /*
+ * Page is either isolated or there is not enough space on the target
+ * node. If isolated, then it has taken a reference count and the
+ * callers reference can be safely dropped without the page
+ * disappearing underneath us during migration. Otherwise the page is
+ * not to be migrated but the callers reference should still be
+ * dropped so it does not leak.
+ */
+ put_page(page);
+
if (isolated) {
int nr_remaining;