aboutsummaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan.kim@gmail.com>2010-10-26 17:21:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 19:52:06 -0400
commitcf608ac19c95804dc2df43b1f4f9e068aa9034ab (patch)
treea84d37df2b0bb57bd9a4b0b466726f5343fa5448 /mm/migrate.c
parente4455abb50a19562dbfdc51a8424fda9b588bd6d (diff)
mm: compaction: fix COMPACTPAGEFAILED counting
Presently update_nr_listpages() doesn't have a role. That's because lists passed is always empty just after calling migrate_pages. The migrate_pages cleans up page list which have failed to migrate before returning by aaa994b3. [PATCH] page migration: handle freeing of pages in migrate_pages() Do not leave pages on the lists passed to migrate_pages(). Seems that we will not need any postprocessing of pages. This will simplify the handling of pages by the callers of migrate_pages(). At that time, we thought we don't need any postprocessing of pages. But the situation is changed. The compaction need to know the number of failed to migrate for COMPACTPAGEFAILED stat This patch makes new rule for caller of migrate_pages to call putback_lru_pages. So caller need to clean up the lists so it has a chance to postprocess the pages. [suggested by Christoph Lameter] Signed-off-by: Minchan Kim <minchan.kim@gmail.com> Cc: Hugh Dickins <hughd@google.com> Cc: Andi Kleen <andi@firstfloor.org> Reviewed-by: Mel Gorman <mel@csn.ul.ie> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Acked-by: Christoph Lameter <cl@linux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index d917ac3207f5..35e454189966 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -883,8 +883,9 @@ out:
883 * 883 *
884 * The function returns after 10 attempts or if no pages 884 * The function returns after 10 attempts or if no pages
885 * are movable anymore because to has become empty 885 * are movable anymore because to has become empty
886 * or no retryable pages exist anymore. All pages will be 886 * or no retryable pages exist anymore.
887 * returned to the LRU or freed. 887 * Caller should call putback_lru_pages to return pages to the LRU
888 * or free list.
888 * 889 *
889 * Return: Number of pages not migrated or error code. 890 * Return: Number of pages not migrated or error code.
890 */ 891 */
@@ -931,8 +932,6 @@ out:
931 if (!swapwrite) 932 if (!swapwrite)
932 current->flags &= ~PF_SWAPWRITE; 933 current->flags &= ~PF_SWAPWRITE;
933 934
934 putback_lru_pages(from);
935
936 if (rc) 935 if (rc)
937 return rc; 936 return rc;
938 937
@@ -1087,9 +1086,12 @@ set_status:
1087 } 1086 }
1088 1087
1089 err = 0; 1088 err = 0;
1090 if (!list_empty(&pagelist)) 1089 if (!list_empty(&pagelist)) {
1091 err = migrate_pages(&pagelist, new_page_node, 1090 err = migrate_pages(&pagelist, new_page_node,
1092 (unsigned long)pm, 0); 1091 (unsigned long)pm, 0);
1092 if (err)
1093 putback_lru_pages(&pagelist);
1094 }
1093 1095
1094 up_read(&mm->mmap_sem); 1096 up_read(&mm->mmap_sem);
1095 return err; 1097 return err;