What kernel mechanism performs memory deduplication by merging identical pages?

The story behind the answer

The Linux kernel mechanism that merges identical memory pages is Kernel Same-page Merging, abbreviated KSM.

KSM scans memory pages used by different processes or virtual machines and identifies pages with identical contents. It keeps one physical copy, remaps the duplicates to that shared page, and marks the mappings copy-on-write. If a process later changes its page, the kernel creates a private copy automatically, preserving correctness while reclaiming memory.

KSM is especially useful with KVM virtualization, where multiple virtual machines may contain many identical operating-system pages. It can also help in non-virtualized workloads with repeated data. The trade-off is that scanning and comparing pages consumes CPU time, so memory savings are not always worth the processing cost.

KSM entered the mainline Linux kernel in version 2.6.32, released in December 2009. HugePages, swap, and memory overcommit address different memory-management goals; none is the kernel's page-deduplication mechanism.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: