KSM (Kernel Samepage Merging)
Kernel Samepage Merging (KSM) allows de-depulication of memory in Linux and has been released with kernel version 2.6.32. KSM tries to find identical Memory Pages and merge those to free memory. It tries to find memory pages that are updated seldom, otherwise it could be inefficient.
Originally KSM was developed for virtual machines. If these virtual machines use the same programs or operating systems, the overall memory usage can be reduced dramatically and more virtual machines can be operated with the available physical RAM.
Some tests from Red Hat have shown, that 52 virtual machines with Windows XP and 1 GB RAM can be operated on one server with only 16 GB RAM.
The virtualization KVM is supporting KSM. Based on this Bug-Report OpenVZ is not supporting it.
The following command allows to check if KSM is integrated into the kernel:
$ grep KSM /boot/config-`uname -r` CONFIG_KSM=y
Further information and configuration options can be found in sysfs file system:
$ ls -1 /sys/kernel/mm/ksm/ full_scans pages_shared pages_sharing pages_to_scan pages_unshared pages_volatile run sleep_millisecs