KSMTUNED(8)
π KSMTUNED(8) π
okay bestie, pull up a chair, because we're about to talk about ksmtuned β that's the ksmtuned</> command from the User Commands corner of the manual (section 8, she's got range). she's a shell script that babysits Kernel Samepage Merging for your qemu girlies and honestly? she's the moment. β¨
πΈ NAME πΈ
ksmtuned β dynamically tune Kernel Samepage Merging (KSM) for qemu workloads π
π¦ SYNOPSIS π¦
ksmtuned
that's it. that's the whole thing. no flags, no arguments, she just goes. no cap.
β¨ DESCRIPTION β¨
so ksmtuned is a background tuning daemon, and the vibe is: she's implemented as a shell script (yes, she's a script and she's THRIVING, don't be weird about it). her whole job is to periodically estimate memory pressure from running qemu processes and then adjust Linux KSM aggressiveness by writing to sysfs</> controls. lowkey a genius.
At startup, the daemon optionally sources /etc/ksmtuned.conf and computes:
- Total RAM from
/proc/meminfo. π - A memory threshold based on
KSM_THRES_COEFandKSM_THRES_CONST. - A sleep interval for KSM scans derived from total memory and
KSM_SLEEP_MSEC.
then, every KSM_MONITOR_INTERVAL seconds, she does the little routine:
- Sums RSS for running qemu processes.
- Checks available memory (
MemFree+Buffers+Cached). - Stops KSM when memory pressure is low.
- Otherwise starts KSM and updates
pages_to_scanusing boost/decay logic.
and here's the cute part β the daemon traps SIGUSR1 while running, which wakes the wait cycle so the next adjustment can happen promptly after VM start/stop events. it's giving "text me and I'll wake up immediately" energy. π«Ά
π OPTIONS π
okay so real talk: ksmtuned has no command-line options. none. zero. she doesn't want them, she doesn't need them. π
ββοΈ
Behavior is configured through environment/configuration variables instead β keep scrolling, that's the next section.
π CONFIGURATION VARIABLES π
The following variables may be set in /etc/ksmtuned.conf:
KSM_MONITOR_INTERVALβ Seconds between tuning passes (default:60).KSM_NPAGES_BOOSTβ Increment applied topages_to_scanwhen free memory is below threshold (default:300).KSM_NPAGES_DECAYβ Adjustment applied when free memory is above threshold (default:-50).KSM_NPAGES_MINβ Minimumpages_to_scan(default:64).KSM_NPAGES_MAXβ Maximumpages_to_scan(default:1250).KSM_SLEEP_MSECβ Base sleep millisecs used to compute/sys/kernel/mm/ksm/sleep_millisecs(default:10).KSM_THRES_COEFβ Percent of total memory used in threshold calculation (default:20).KSM_THRES_CONSTβ Minimum threshold in KiB (default:2048).PIDFILEβ Path to write daemon PID (default:/var/run/ksmtune.pid).DEBUGβ If non-empty, enable debug logging.LOGFILEβ Optional log destination used whenDEBUGis set.
bestie, notice how the numbers are exact. we do NOT freestyle the defaults. the defaults are sacred. π
π FILES π
/etc/ksmtuned.confβ Optional runtime configuration./proc/meminfoβ Source for total/free memory data./sys/kernel/mm/ksm/runβ Enable/disable KSM./sys/kernel/mm/ksm/pages_to_scanβ Tune KSM scan intensity./sys/kernel/mm/ksm/sleep_millisecsβ Tune pause between KSM scans./var/run/ksmtune.pidβ Default PID file for the spawned loop process.
β SEE ALSO β
ksmctl(1), systemd(1), proc(5), ksm(7)
go read those too, they're the friend group. the girlies. the whole squad. π¦
and that's the whole page!! this was ksmtuned from KSMTUNED(8), User Commands, dated April 2026. she ate and left no crumbs, periodt. πβ¨π
π¦ where this page comes from
- ubuntu stonking: ksmtuned 4.20180327-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms