aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2013-02-22 19:36:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 20:50:23 -0500
commitb599cbdf1c2d88eac7caed00854ee4eecb119a6b (patch)
tree462aed2877959d1cd0b10cd4ee68323da23dc582 /mm
parent8fdb3dbf02335d96bf170321381522709ba63a0c (diff)
ksm: treat unstable nid like in stable tree
An inconsistency emerged in reviewing the NUMA node changes to KSM: when meeting a page from the wrong NUMA node in a stable tree, we say that it's okay for comparisons, but not as a leaf for merging; whereas when meeting a page from the wrong NUMA node in an unstable tree, we bail out immediately. Now, it might be that a wrong NUMA node in an unstable tree is more likely to correlate with instablility (different content, with rbnode now misplaced) than page migration; but even so, we are accustomed to instablility in the unstable tree. Without strong evidence for which strategy is generally better, I'd rather be consistent with what's done in the stable tree: accept a page from the wrong NUMA node for comparison, but not as a leaf for merging. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Petr Holasek <pholasek@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Izik Eidus <izik.eidus@ravellosystems.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/ksm.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mm/ksm.c b/mm/ksm.c
index c067e8dbcc79..c059ca1c9356 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1342,16 +1342,6 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
1342 return NULL; 1342 return NULL;
1343 } 1343 }
1344 1344
1345 /*
1346 * If tree_page has been migrated to another NUMA node, it
1347 * will be flushed out and put into the right unstable tree
1348 * next time: only merge with it if merge_across_nodes.
1349 */
1350 if (!ksm_merge_across_nodes && page_to_nid(tree_page) != nid) {
1351 put_page(tree_page);
1352 return NULL;
1353 }
1354
1355 ret = memcmp_pages(page, tree_page); 1345 ret = memcmp_pages(page, tree_page);
1356 1346
1357 parent = *new; 1347 parent = *new;
@@ -1361,6 +1351,15 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
1361 } else if (ret > 0) { 1351 } else if (ret > 0) {
1362 put_page(tree_page); 1352 put_page(tree_page);
1363 new = &parent->rb_right; 1353 new = &parent->rb_right;
1354 } else if (!ksm_merge_across_nodes &&
1355 page_to_nid(tree_page) != nid) {
1356 /*
1357 * If tree_page has been migrated to another NUMA node,
1358 * it will be flushed out and put in the right unstable
1359 * tree next time: only merge with it when across_nodes.
1360 */
1361 put_page(tree_page);
1362 return NULL;
1364 } else { 1363 } else {
1365 *tree_pagep = tree_page; 1364 *tree_pagep = tree_page;
1366 return tree_rmap_item; 1365 return tree_rmap_item;