[SOLVED] KSM in mixed OpenVZ/KVM environment on Proxmox VE 3.4

Jun 21, 2011
Hi! I have Proxmox VE 3.4-3 with kernel 2.6.32-37-pve. My server runs several OpenVZ containers together with KVM virtual machines.
At the moment cat /sys/kernel/mm/ksm/pages_sharing returns 0 and that's fine because my RAM usage is under 80% and KSM_THRES_COEF=20 in /etc/ksmtuned.conf.
My question is: if my node runs over 80% RAM usage will KSM consolidate RAM used both by OpenVZ CTs and KVM VMs? Because I've read somewhere on the internet that OpenVZ kernels do not support KSM, but I found no evidence of this on Proxmox's wiki, even though it never explicitly mentions Openvz on KSM pages.
Do you have any certain informations on this? Unfortunately I need this informations to decide how many CTs and VMs migrate on this node.
Thank you!


Proxmox Staff Member
Staff member
Aug 29, 2006
Nobody? :-(

As 3.4 is already out of support you are quite alone here, as nobody use this here anymore. Plan the upgrade to 4.x or even 5.x
Jun 21, 2011
Yes, you're absolutely right, an upgrade is scheduled before the end of this year. But unfortunately I need to move some VMs to that host. So the question is: if this hosts runs both VMs and OpenVZ containers, will KSM work at least for the processes running on the VMs or it will not work at all? And, even worse, can it cause troubles and so I should disable it before the RAM usage grows over 80% triggering KSM?
Thank you so much!


Well-Known Member
Jun 4, 2008
Hi, for what it is worth. My observation of KSM use in your older version (3.X) of proxmox - is that 'KVM VMs running same OS' would play friendly with KSM. That was about the size of it. So if I spun up 6 x Win2008r2 /64bit VMs - then let things sit for a bit - I could watch the RAM use decrease and the KSM Ram-recovery .. march up as identical ram pages were located and mapped and 'freed'. But this was ore or less the scope of the successful use-case. KVM based VMs. Generally multiple copies of the ~same OS on multiple KVM Vms on the one host. And the expectation that you have enough ram available to boot up everything in one shot with zero KSM at first; and then KSM gradually gets busy as time elapses. (or you boot up your VMs in a staged manner if you are actually overcommiting your RAM on the physical host in a significant way, to let KSM chew things back .. as you gradually bring more VMs online).

I'm not sure what you want (OpenVZ <> and <> KVM - KSM action ) - is actually possible. Possibly someone else will counter this statement though, I don't know.

Jun 21, 2011
For anyone interested, I changed KSM_THRES_COEF value to 50 in /etc/ksmtuned.conf and then issued a service ksmtuned restart without having to reboot the node. In a couple of minutes KSM began to consolidate my RAM in my OpenVZ/KVM hybrid environment based on Proxmox VE 3.4 without any problem and has been running now stable for a week! :)


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!