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

Message ID 1529016629-2948-1-git-send-email-daniel.diaz@linaro.org
State New
Headers show
Series
  • [1/2] x86: x86_64_defconfig: Enable KSM.
Related show

Commit Message

Daniel Díaz June 14, 2018, 10:50 p.m.
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:
  https://www.kernel.org/doc/Documentation/vm/ksm.txt

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

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>

---
 arch/x86/configs/x86_64_defconfig | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4

Comments

Thomas Gleixner June 15, 2018, 8:27 a.m. | #1
On Thu, 14 Jun 2018, 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:

>   https://www.kernel.org/doc/Documentation/vm/ksm.txt

> 

> 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


We all know that, but the above does not make an argument WHY this needs to
be enabled in defconfig.

Thanks,

	tglx
Austin S. Hemmelgarn June 15, 2018, 12:23 p.m. | #2
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:

>    https://www.kernel.org/doc/Documentation/vm/ksm.txt

> 

> 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).


[1] https://my-netdata.io/

Patch

diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index e32fc1f..8fd7396 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -48,6 +48,7 @@  CONFIG_MICROCODE_AMD=y
 CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
 CONFIG_NUMA=y
+CONFIG_KSM=y
 CONFIG_X86_CHECK_BIOS_CORRUPTION=y
 # CONFIG_MTRR_SANITIZER is not set
 CONFIG_EFI=y