Re: [PATCH 1/2] x86: x86_64_defconfig: Enable KSM.

From: Austin S. Hemmelgarn
Date: Fri Jun 15 2018 - 08:23:50 EST

On 2018-06-14 18:50, Daniel DÃaz wrote:
As per the documentation, Kernel Samepage Merging (available
since 2.6.32) is a memory-saving de-duplication feature,
enabled by CONFIG_KSM=y and activated via sysfs. More
information can be found here:

When enabled in the kernel, the default is to not do anything
at all, until it is activated at run-time with:
echo 1 > /sys/kernel/mm/ksm/run

As pointed out by a couple of others, this doesn't explain why this is a good idea. All you're doing here is giving a reason that it won't have a negative impact on most users.

Two points that may be worth adding, but also don't really argue for it being a significant improvement:

* Pretty much all of the major distributions that use pre-built kernels have it enabled in their kernels (At minimum, Debian, Ubuntu, Fedora (and by extension RHEL and CentOS), openSUSE (and by extension SLES), Arch, and Alpine have it enabled), so enabling this in defconfig would bring it a bit closer to parity with distribution kernels in terms of core features.

* Software other than QEMU is starting to take advantage of it if available (for example, Netdata [1] can mark it's in-memory TSDB's for deduplication, which usually cuts it's memory usage roughly in half).