summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/ksm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/ksm.c b/mm/ksm.c
index 486c9974f8e2..159604ad4779 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1909,12 +1909,15 @@ again:
if (page_node) {
VM_BUG_ON(page_node->head != &migrate_nodes);
/*
- * Test if the migrated page should be merged
- * into a stable node dup. If the mapcount is
- * 1 we can migrate it with another KSM page
- * without adding it to the chain.
+ * If the mapcount of our migrated KSM folio is
+ * at most 1, we can merge it with another
+ * KSM folio where we know that we have space
+ * for one more mapping without exceeding the
+ * ksm_max_page_sharing limit: see
+ * chain_prune(). This way, we can avoid adding
+ * this stable node to the chain.
*/
- if (page_mapcount(page) > 1)
+ if (folio_mapcount(folio) > 1)
goto chain_append;
}