dynamips icon indicating copy to clipboard operation
dynamips copied to clipboard

KSM to reduce memory consumption

Open grossmj opened this issue 12 years ago • 7 comments

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

grossmj avatar Sep 25 '13 18:09 grossmj

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 avatar Sep 26 '13 03:09 flaviojs

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.

flaviojs avatar Sep 26 '13 04:09 flaviojs

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.

ikiris avatar Oct 13 '13 22:10 ikiris

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:

flaviojs avatar Nov 25 '13 03:11 flaviojs

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.

ikiris avatar Nov 25 '13 18:11 ikiris

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

grossmj avatar Feb 06 '14 07:02 grossmj

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 :)

darkstar avatar Mar 31 '14 13:03 darkstar