A KVM host often contains several virtual machines that use memory pages containing the same content (such as operating system information). With KSM, those memory pages are identified and then merged to one location. In this sense, KSM is similar to data deduplication for memory.
KSM enables a more efficient use of available memory, potentially allowing a server to run more processes than would be possible if KSM was not used. For example, under the right circumstances, KSM could allow a virtualization host with 16 GB of memory to host more than 16 virtual machines with 1 GB of memory each. This level of overcommitment is possible because virtual machines on the same host often share many duplicate memory pages.
KSM isn’t recommended for every scenario. Although KSM improves memory efficiency, it requires more CPU resources to identify duplicate pages and monitoring those pages to ensure their data doesn’t deviate.