It's a Linux Kernel module, and used for share physical memory on different vm, especially useful for KVM. Here is a detailed description:http://lwn.net/Articles/306642/
The following copied from this URL:
KSM is a linux driver that allows dynamicly sharing identical memory pages
between one or more processes.
unlike traditional page sharing that is made at the allocation of the
memory, ksm do it dynamically after the memory was created.
Memory is periodically scanned; identical pages are identified and merged.
the sharing is unnoticeable by the process that use this memory.
(the shared pages are marked as read only, and in case of write
do_wp_page() take care to create new copy of the page)
this driver is very useful for KVM as in cases of running multiple guests
operation system of the same type, many pages are sharable.
this driver can be useful by OpenVZ as well.
KSM right now scan just memory that was registered to used by it, it
does not scan the whole system memory (this can be changed, but the changes to find
identical pages in normal linux system that doesn't run multiple guests)
KSM can run as kernel thread or as userspace application (or both (it is
allowed to run more than one scanner in a time)).