mm: when migrate_pages returns 0, all pages must have been released

In some cases migrate_pages could return zero while still leaving a few
pages in the pagelist (and some caller wouldn't notice it has to call
putback_lru_pages after commit cf608ac19c ("mm: compaction: fix
COMPACTPAGEFAILED counting")).

Add one missing putback_lru_pages not added by commit cf608ac19c ("mm:
compaction: fix COMPACTPAGEFAILED counting").

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Andrea Arcangeli 2011-02-01 15:52:32 -08:00 committed by Linus Torvalds
parent 552b372ba9
commit 57fc4a5ee3
2 changed files with 2 additions and 2 deletions

View File

@ -1419,6 +1419,7 @@ int soft_offline_page(struct page *page, int flags)
ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
0, true); 0, true);
if (ret) { if (ret) {
putback_lru_pages(&pagelist);
pr_info("soft offline: %#lx: migration failed %d, type %lx\n", pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
pfn, ret, page->flags); pfn, ret, page->flags);
if (ret > 0) if (ret > 0)

View File

@ -772,6 +772,7 @@ uncharge:
unlock: unlock:
unlock_page(page); unlock_page(page);
move_newpage:
if (rc != -EAGAIN) { if (rc != -EAGAIN) {
/* /*
* A page that has been migrated has all references * A page that has been migrated has all references
@ -785,8 +786,6 @@ unlock:
putback_lru_page(page); putback_lru_page(page);
} }
move_newpage:
/* /*
* Move the new page to the LRU. If migration was not successful * Move the new page to the LRU. If migration was not successful
* then this will free the page. * then this will free the page.