Skip to content

Commit 57fc4a5

Browse files
aarcange-rhtorvalds
authored andcommitted
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 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 <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>
1 parent 552b372 commit 57fc4a5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎mm/memory-failure.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ int soft_offline_page(struct page *page, int flags)
14191419
ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
14201420
0, true);
14211421
if (ret) {
1422+
putback_lru_pages(&pagelist);
14221423
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
14231424
pfn, ret, page->flags);
14241425
if (ret > 0)

‎mm/migrate.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
772772
unlock:
773773
unlock_page(page);
774774

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

788-
move_newpage:
789-
790789
/*
791790
* Move the new page to the LRU. If migration was not successful
792791
* then this will free the page.

0 commit comments

Comments
 (0)