Page 1 of 1

KSM and MX Linux

Posted: Thu Nov 08, 2018 5:22 pm
by postcd
Apparently MX Linux has KSM disabled by default, when i enabled it:
echo 1 >/sys/kernel/mm/ksm/run
echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs
i saved around 10MB of memory using this memory deduplication mechanism.

Re: KSM and MX Linux

Posted: Mon Dec 24, 2018 4:10 pm
by xinomilo
init script for enabling ksm init script on boot : https://dnaeon.github.io/enable-ksm-dur ... -on-linux/

Re: KSM and MX Linux

Posted: Mon Dec 24, 2018 4:27 pm
by anticapitalista
xinomilo wrote:
Mon Dec 24, 2018 4:10 pm
init script for enabling ksm init script on boot : https://dnaeon.github.io/enable-ksm-dur ... -on-linux/
"Written on November 23, 2012"

So, is it still needed in 2018?

Re: KSM and MX Linux

Posted: Mon Dec 24, 2018 11:21 pm
by BitJam
anticapitalista wrote:
Mon Dec 24, 2018 4:27 pm
"Written on November 23, 2012"

So, is it still needed in 2018?
KSM is enabled in the 4.9.126-antix.1 kernel. You could try turning it on and see if there is any savings:

Code: Select all

free -m
echo 1 | sudo tee /sys/kernel/mm/ksm/run
echo 1000 | sudo tee /sys/kernel/mm/ksm/sleep_millisecs
free -m
sleep 1
free -m
You can test if it is enabled with:

Code: Select all

cat /sys/kernel/mm/ksm/run
and you can see how many memory pages are being shared with:

Code: Select all

cat /sys/kernel/mm/ksm/pages_sharing
If you are running multiple virtual machines there will probably be significant savings. I don't expect a lot of savings on simple desktop systems.

Re: KSM and MX Linux

Posted: Tue Dec 25, 2018 1:41 pm
by xinomilo
anticapitalista wrote:
Mon Dec 24, 2018 4:27 pm
"Written on November 23, 2012"

So, is it still needed in 2018?
without systemd, howtos from 2012 for sysv still apply.. :)
as init script for enabling KSM on boot...

kvm page about KSM is a bit older (2010, revised 2015): https://www.linux-kvm.org/page/KSM , but still valid to this day.

i agree with BitJam though, savings come for virtualization (local virtual machines), not much in desktop apps. from what i understand only a few local apps with multiple instances might see differences, but maybe i'm mistaken there, not so sure about that. using KSM in KVM hosts only, and yes, i've seen savings there.

Re: KSM and MX Linux

Posted: Tue Dec 25, 2018 6:54 pm
by BitJam
I created an antiX-17.2 live-usb and tried my KSM instructions above. There were zero saving and zero shared pages both before and after starting X. Maybe you will get some savings if there are more programs or windows open. ISTM it is not worthwhile to have this installed or enabled by default. OTOH there are some circumstances where it would be extremely useful so it is good we have it enabled in the kernel.