[pve-devel] [PATCH ksm-control-daemon 1/1] Allow to disable ksm merge_across_nodes

Alexandre Derumier aderumier at odiso.com
Mon Oct 9 09:19:21 CEST 2017


This allow to disable /sys/kernel/mm/ksm/merge_across_nodes.
(keep defaults to 1, to not change current behaviour).

By default, ksm can merge pages across nodes, which can impact latency.
(moving pages from node1 to node0 for example, and kvm thread still running on node1).

This need to be setup before ksm is running.

redhat reference:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/chap-ksm
---
 debian/defaults         | 2 ++
 debian/ksmtuned.service | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/defaults b/debian/defaults
index e4a92db..a821b30 100644
--- a/debian/defaults
+++ b/debian/defaults
@@ -10,3 +10,5 @@
 # start ksmtuned at boot [yes|no]
 START=yes
 
+# disable ksm merge across numa nodes
+# MERGE_ACROSS_NODES=0
diff --git a/debian/ksmtuned.service b/debian/ksmtuned.service
index ffdaee1..1d14e71 100644
--- a/debian/ksmtuned.service
+++ b/debian/ksmtuned.service
@@ -2,9 +2,12 @@
 Description=Kernel Samepage Merging (KSM) Tuning Daemon
 
 [Service]
+Environment="MERGE_ACROSS_NODES=1"
+EnvironmentFile=/etc/default/ksmtuned
+ExecStartPre=/bin/bash -c '/bin/echo ${MERGE_ACROSS_NODES} > /sys/kernel/mm/ksm/merge_across_nodes'
 ExecStart=/usr/sbin/ksmtuned
 ExecReload=/bin/kill -USR1 $MAINPID
 Type=forking
 
 [Install]
-WantedBy=multi-user.target
\ No newline at end of file
+WantedBy=multi-user.target
-- 
2.11.0



More information about the pve-devel mailing list