Monday, June 15, 2015

Enable Memory Page Sharing (KSM)


By default, Linux kernel manages KSM so you don't need to worry about memory management. At 80%, kernel turns KSM on and Magic begins. KSM can lower down memory utilization by double and more.

Enable it if you have doubt:
---
vdsClient -s 0 setMOMPolicyParameters ksmEnabled=True


Check if KSM deamons are operational :
-----
for i in ksm ksmtuned; do service $i status ; chkconfig $i --list ; done

Edit below file to see debug (uncomment debugging and log file) info:
---
vi /etc/ksmtuned.conf

Restart Deamons:
---
for i in ksm ksmtuned; do service $i restart ; done


Check log:
---
tail -f /var/log/ksmtuned

and

cat /sys/kernel/mm/ksm/run

1 > means KSM active
0 > inactive KSM


----------

KSM starts only when the threshold free memory limit is reached i.e above 80% and it will be stopped automatically if the memory usage is under the threshold limit. So, you may not see KSM  as enabled always and therefore the 'Memory Page Sharing' status as well. 

So once you have more load i.e more VMS running on host the vdsm will 'enable' KSM as require after that it'll reflect 'Memory Page Sharing' status 'enable' in RHEVM GUI a well.

MoM isn't a specific service, but a vdsm thread. Restarting vdsm is restarting MoM. To enable/disable KSM, MoM is considering the policy file /etc/vdsm/mom.d/03-ksm.policy. It hasn't a trivial notation, but in short, current version is telling MoM to enable KSM when free memory goes below 20% of total memory.

For more details please refer below kbase,

 >> Refer : Why is KSM not working on my RHEL Virtualization Host?

 >> Refer : In RHEV 3.3, ksmtuned service is stopped. So, how is KSM being controlled?




No comments:

Post a Comment