Language and Page Formatting Options
Chapter 7. KSM
qemu-kvmprocess. Once the guest virtual machine is running, the contents of the guest virtual machine operating system image can be shared when guests are running the same operating system or applications.
0to avoid merging pages across NUMA nodes. Kernel memory accounting statistics can eventually contradict each other after large amounts of cross-node merging. As such, numad can become confused after the KSM daemon merges large amounts of memory. If your system has a large amount of free memory, you may achieve higher performance by turning off and disabling the KSM daemon. Refer to the Red Hat Enterprise Linux Performance Tuning Guide for more information on NUMA.
ksmservice starts and stops the KSM kernel thread.
ksmtunedservice controls and tunes the
ksm, dynamically managing same-page merging. The
ksmand stops the
ksmservice if memory sharing is not necessary. The
ksmtunedservice must be told with the
retuneparameter to run when new guests are created or destroyed.
ksm service is included in the qemu-kvm package. KSM is off by default on Red Hat Enterprise Linux 6. When using Red Hat Enterprise Linux 6 as a KVM host physical machine, however, it is likely turned on by the
ksmservice is not started, KSM shares only 2000 pages. This default is low and provides limited memory saving benefits.
ksmservice is started, KSM will share up to half of the host physical machine system's main memory. Start the
ksmservice to enable KSM to share more memory.
# service ksm start Starting ksm: [ OK ]
ksmservice can be added to the default startup sequence. Make the
ksmservice persistent with the chkconfig command.
# chkconfig ksm on
ksmtuned service does not have any options. The
ksmtuned service loops and adjusts
ksmtuned service is notified by libvirt when a guest virtual machine is created or destroyed.
# service ksmtuned start Starting ksmtuned: [ OK ]
ksmtunedservice can be tuned with the
ksmtunedto run tuning functions manually.
thres- Activation threshold, in kbytes. A KSM cycle is triggered when the
thresvalue added to the sum of all
qemu-kvmprocesses RSZ exceeds total system memory. This parameter is the equivalent in kbytes of the percentage defined in
/etc/ksmtuned.conffile is the configuration file for the
ksmtunedservice. The file output below is the default
# Configuration file for ksmtuned. # How long ksmtuned should sleep between tuning adjustments # KSM_MONITOR_INTERVAL=60 # Millisecond sleep between ksm scans for 16Gb server. # Smaller servers sleep more, bigger sleep less. # KSM_SLEEP_MSEC=10 # KSM_NPAGES_BOOST is added to the
free memoryis less than
thres. # KSM_NPAGES_BOOST=300 # KSM_NPAGES_DECAY Value given is subtracted to the
free memoryis greater than
thres. # KSM_NPAGES_DECAY=-50 # KSM_NPAGES_MIN is the lower limit for the
npagesvalue. # KSM_NPAGES_MIN=64 # KSM_NAGES_MAX is the upper limit for the
npagesvalue. # KSM_NPAGES_MAX=1250 # KSM_TRES_COEF - is the RAM percentage to be calculated in parameter
thres. # KSM_THRES_COEF=20 # KSM_THRES_CONST - If this is a low memory system, and the
thresvalue is less than
KSM_THRES_CONST, then reset
KSM_THRES_CONSTvalue. # KSM_THRES_CONST=2048 # uncomment the following to enable ksmtuned debug information # LOGFILE=/var/log/ksmtuned # DEBUG=1
KSM stores monitoring data in the
/sys/kernel/mm/ksm/ directory. Files in this directory are updated by the kernel and are an accurate record of KSM usage and statistics.
/etc/ksmtuned.conffile as noted below.
- Full scans run.
- Total pages shared.
- Pages presently shared.
- Pages not scanned.
- Pages no longer shared.
- Number of volatile pages.
- Whether the KSM process is running.
- Sleep milliseconds.
/var/log/ksmtunedlog file if the
DEBUG=1line is added to the
/etc/ksmtuned.conffile. The log file location can be changed with the
LOGFILEparameter. Changing the log file location is not advised and may require special configuration of SELinux settings.
KSM has a performance overhead which may be too large for certain environments or host physical machine systems.
ksmservice. Stopping the services deactivates KSM but does not persist after restarting.
# service ksmtuned stop Stopping ksmtuned: [ OK ] # service ksm stop Stopping ksm: [ OK ]
chkconfigcommand. To turn off the services, run the following commands:
# chkconfig ksm off # chkconfig ksmtuned off