Skip to content

Commit

Permalink
mm: migrate: Drop the misplaced pages reference count if the target n…
Browse files Browse the repository at this point in the history
…ode 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>
  • Loading branch information
Mel Gorman committed Dec 11, 2012
1 parent 7039e1d commit 149c33e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 149c33e

Please sign in to comment.