Jump to content

Talk:Kernel same-page merging

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Why not just copy on write?

[edit]

I am wondering how this differs from the usual copy on write? Does Linux go through and compare pages (more likely checksums of pages) to find duplicates? The more usual way is to know that they are duplicates in the first place. As far as I know, back to VM/370, when loading a saved system, CP would use copy on write for any pages in that system. Anyone IPLing another copy of an already loaded saved system would just use the original pages, marked for copy write. I suspect that other hypervisors do the same thing. Gah4 (talk) 09:18, 15 January 2017 (UTC)[reply]

Not a forum...

[edit]

This is not a forum for general discussion of the article's subject. Though since you asked... KSM is used for hosts of virtual machines (VMs). The kernels inside the VMs don't know about the other machines and the host kernel doesn't know anything about the kernels inside those VMs, so there is no way to tell each other that they will use the exact same .so or .dll file or executables. This is very different from regular processes where the kernel knows that the inode (file) is the same so it will just map the pages and do copy on write. So, yes, the only way is to use checksums of pages, which is time consuming in itself but useful anyway depending on the situation. Note that it is not enabled by default. Ibaldo (talk) 15:42, 15 January 2017 (UTC)[reply]

The reason for the question was not for general interest, but for the possible addition to the page. Since VM/370 figured this out about 50 years ago, I was wondering how it was done different. Since memory was smaller in the VM/370 days, saving real memory pages was pretty important. As above, the system is IPLed in the usual way, stopped, and then the whole contents of guest virtual storage written out. You can then run any number of them, and VM knows which pages are the same. It uses copy on write when any page is changed. If none of that is useful here, that is fine. Gah4 (talk) 03:32, 8 November 2020 (UTC)[reply]