Commit b599cbdf authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

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: default avatarHugh 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8fdb3dbf
...@@ -1342,16 +1342,6 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item, ...@@ -1342,16 +1342,6 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
return NULL; return NULL;
} }
/*
* If tree_page has been migrated to another NUMA node, it
* will be flushed out and put into the right unstable tree
* next time: only merge with it if merge_across_nodes.
*/
if (!ksm_merge_across_nodes && page_to_nid(tree_page) != nid) {
put_page(tree_page);
return NULL;
}
ret = memcmp_pages(page, tree_page); ret = memcmp_pages(page, tree_page);
parent = *new; parent = *new;
...@@ -1361,6 +1351,15 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item, ...@@ -1361,6 +1351,15 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
} else if (ret > 0) { } else if (ret > 0) {
put_page(tree_page); put_page(tree_page);
new = &parent->rb_right; new = &parent->rb_right;
} else if (!ksm_merge_across_nodes &&
page_to_nid(tree_page) != nid) {
/*
* If tree_page has been migrated to another NUMA node,
* it will be flushed out and put in the right unstable
* tree next time: only merge with it when across_nodes.
*/
put_page(tree_page);
return NULL;
} else { } else {
*tree_pagep = tree_page; *tree_pagep = tree_page;
return tree_rmap_item; return tree_rmap_item;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment