Correct way to KSM tunig and manage - 2.6.32

elkondor

Renowned Member
Jan 20, 2010
43
0
71
Italy
www.opensupport.it
I read in documentation of KSM that:
/sys/kernel/mm/ksm/
run - set 0 to stop ksmd from running but keep merged pages,
- set 1 to run ksmd e.g. "echo 1 > /sys/kernel/mm/ksm/run",
- set 2 to stop ksmd and unmerge all pages currently merged,
but leave mergeable areas registered for next run
Default: 0 (must be changed to 1 to activate KSM,
except if CONFIG_SYSFS is disabled)

In this moment i don't need KSM feature because use a lot of cpu (isn't a big machine host) and i don't have a lot machine working

First i tune /etc/ksmtuned.conf in this way and i reduce the use of CPU
# Configuration file for ksmtuned.

# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60
KSM_MONITOR_INTERVAL=480


# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10
KSM_SLEEP_MSEC=50

# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250
KSM_NPAGES_MAX=256


# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048
KSM_THRES_CONST=1024

My question is if is correct turn KSM on or off by ONLY echoing a 1 or 0 to /sys/kernel/mm/ksm/run.
Simply add a line in rc.local and stop at boot the ksm daemon?

Correct way?

Thanks.
 
My question is if is correct turn KSM on or off by ONLY echoing a 1 or 0 to /sys/kernel/mm/ksm/run.
Simply add a line in rc.local and stop at boot the ksm daemon?

No, instead edit /etc/default/ksmtuned (set 'START=no').
 
first stop the ksm daemon, then edit the defaults file to prevent startup at boot. Then use 'echo' to disable ksm.