Enable KSM Centos7/Debian

If you run a lot of Virtual Machines using qemu, you probably can save a lot of memory, at the expense of CPU cycles, by enabling Kernel Samepage Merging (KSM).
If you just want to test it and run only on the current boot run the following:

echo 1 > /sys/kernel/mm/ksm/run

After testing if you want to enable it permanently you can use systemd temporary files.
Continue reading “Enable KSM Centos7/Debian”