GNS3 / dynamips

Dynamips development
GNU General Public License v2.0
355 stars 95 forks source link

KSM to reduce memory consumption #23

Open grossmj opened 11 years ago

grossmj commented 11 years ago

Someone on the forum has submitted this idea. Don't know if this is feasible but I find it interesting.

http://forum.gns3.net/topic6391.html

flaviojs commented 11 years ago

The "Translation Sharing Groups" code in unstable uses a similar concept. It reduces memory by sharing jit-generated code between routers that use the same image.

flaviojs commented 11 years ago

Unfortunately I don't have any hardware with a processor that supports virtualization technology, therefore I can't play around with KSM. This issue is postponed.

ikiris commented 11 years ago

The point of wanting KSM is not in a single dynamips process, but to be able to share across all of them. For example if I have 50+ routers loaded, they are going to be spread over many processes, and those can easily share similar memory between them.

Also, all that is really needed is the memory used by the images to be marked as MADV_MERGABLE.

flaviojs commented 10 years ago

It's good to know that it's easy to implement. I won't code it since I can't test it, but I'll accept a patch or pull request if anyone is willing to code it. :wink:

ikiris commented 10 years ago

To my knowledge, KSM has no such requirement for VT extensions. I think you might be conflating KSM and KVM, due to how KSM originally came about. The KSM functionality is completely in kernel, and included in mainline as of some time ago. Even my ATOM board for example runs it. It just generally isn't turned on because it's rare you run into a situation where you'd benefit from it more than the performance penalty, except in cases of virtualization, which KVM and dynamips effectively are.

grossmj commented 10 years ago

After reading this http://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvm I think the implement could be straightforward.

darkstar commented 10 years ago

Yeah, it's definitely a simple

madvise(..., MADV_MERGEABLE)

to make different dynamips processes share memory. I, too, would like to see this implemented in a future version :)