Thanks, this sounds very interesting. On the other hand, are there any security implications? (especially if one assumes that hypervisor is _not_ bug-free)
edit: I did some initial research and yes, it may have some security implications. However I believe it is not a major concern since the original idea was to use VMs to isolate instances of Windows XP which right now should be considered unsafe anyways
KSM is also not totally free, a good amount of CPU time has to be spent to search for merging opportunities (this amount scales logarithmically with the amount of pages to scan).
There is also a simple security implication, since you now have the possibility to over-allocate your physical memory, and suffer great consequences if many pages are unshared at the same time. Merged pages can be swapped out, but since they need to be scanned again when they are swapped in, BEFORE being merged, there is a great potential for memory pressure spikes in some configurations.
https://wiki.archlinux.org/index.php/QEMU#Overlay_storage_im...
https://wiki.archlinux.org/index.php/QEMU#Enabling_KSM