aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-06-04 19:08:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:06 -0400
commit68711a746345c44ae00c64d8dbac6a9ce13ac54a (patch)
treed6a3df9bf1894362bcae1ecefb7c43598e009d99 /mm/mempolicy.c
parent93f39eea9c229778361ae7ecf5f5e95d291757da (diff)
mm, migration: add destination page freeing callback
Memory migration uses a callback defined by the caller to determine how to allocate destination pages. When migration fails for a source page, however, it frees the destination page back to the system. This patch adds a memory migration callback defined by the caller to determine how to free destination pages. If a caller, such as memory compaction, builds its own freelist for migration targets, this can reuse already freed memory instead of scanning additional memory. If the caller provides a function to handle freeing of destination pages, it is called when page migration fails. If the caller passes NULL then freeing back to the system will be handled as usual. This patch introduces no functional change. Signed-off-by: David Rientjes <rientjes@google.com> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Acked-by: Mel Gorman <mgorman@suse.de> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Greg Thelen <gthelen@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 7f7864b95e8e..16bc9fa42998 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1028,7 +1028,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
1028 flags | MPOL_MF_DISCONTIG_OK, &pagelist); 1028 flags | MPOL_MF_DISCONTIG_OK, &pagelist);
1029 1029
1030 if (!list_empty(&pagelist)) { 1030 if (!list_empty(&pagelist)) {
1031 err = migrate_pages(&pagelist, new_node_page, dest, 1031 err = migrate_pages(&pagelist, new_node_page, NULL, dest,
1032 MIGRATE_SYNC, MR_SYSCALL); 1032 MIGRATE_SYNC, MR_SYSCALL);
1033 if (err) 1033 if (err)
1034 putback_movable_pages(&pagelist); 1034 putback_movable_pages(&pagelist);
@@ -1277,7 +1277,7 @@ static long do_mbind(unsigned long start, unsigned long len,
1277 if (!list_empty(&pagelist)) { 1277 if (!list_empty(&pagelist)) {
1278 WARN_ON_ONCE(flags & MPOL_MF_LAZY); 1278 WARN_ON_ONCE(flags & MPOL_MF_LAZY);
1279 nr_failed = migrate_pages(&pagelist, new_vma_page, 1279 nr_failed = migrate_pages(&pagelist, new_vma_page,
1280 (unsigned long)vma, 1280 NULL, (unsigned long)vma,
1281 MIGRATE_SYNC, MR_MEMPOLICY_MBIND); 1281 MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
1282 if (nr_failed) 1282 if (nr_failed)
1283 putback_movable_pages(&pagelist); 1283 putback_movable_pages(&pagelist);