Skip to content

Commit

Permalink
mm: when migrate_pages returns 0, all pages must have been released
Browse files Browse the repository at this point in the history
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 cf608ac ("mm: compaction: fix
COMPACTPAGEFAILED counting")).

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

Signed-off-by: Andrea Arcangeli <[email protected]>
Signed-off-by: Minchan Kim <[email protected]>
Reviewed-by: Minchan Kim <[email protected]>
Cc: Christoph Lameter <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
aagit authored and torvalds committed Feb 3, 2011
1 parent 552b372 commit 57fc4a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,7 @@ int soft_offline_page(struct page *page, int flags)
ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
0, true);
if (ret) {
putback_lru_pages(&pagelist);
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
pfn, ret, page->flags);
if (ret > 0)
Expand Down
3 changes: 1 addition & 2 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
unlock:
unlock_page(page);

move_newpage:
if (rc != -EAGAIN) {
/*
* A page that has been migrated has all references
Expand All @@ -785,8 +786,6 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
putback_lru_page(page);
}

move_newpage:

/*
* Move the new page to the LRU. If migration was not successful
* then this will free the page.
Expand Down

0 comments on commit 57fc4a5

Please sign in to comment.