Yes. In fact KSM can be used on any Linux process although you have to mark the regions that can be merged with a special mmap flag. It works well with VMs because they basically mmap a huge chunk of sequential memory (for the VM's RAM) which is marked thus.
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.3...