On 16/03/2010 12:31, Stan Hoeppner wrote:
IMHO, all modern Unix-alike system just "map" code pages read-only into the process and share them among all processes. No KSM required at all.
If this were the case with Linux then the KSM project would have never been initiated? You attribute far too much intelligence to the stock *nix kernels WRT memory management, specifically de-duplication. AFAIK none of them in a stock configuration do what your humble opinion suggests.
I don't think you are correct here?
If KVM guests were commonly implemented using a shared COW filesystem, ie with all binaries linked to the same inodes on all guests then there would be little need for the KSM because normal memory management would de-dup as expected...
The reality is that this is not (normally) how people build guests... Hence why the KSM is desirable and has been implemented.
On virtualisation solutions such as linux-vservers (and perhaps openvz, etc) you have a tool called "vhashify" which literally hardlinks all the shared files together across all guest filesystems and adds a COW hardlink breaking feature to the kernel. This achieves exactly what we expect that the hardlinked libraries are loaded only once and effectively de-duped. This ^^ exists today and is in production use and provides the incentive for KSM which is slightly cleverer and can de-dup without the hint of the hardlinks (and perhaps de-dup a bit more extensively under some circumstances)
In summary I believe that unix-alike systems do largely behave as described in the previous post? This doesn't make KSM useless, but it's a tool which needs to be used carefully and frugally
Regards
Ed W