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

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Oct 9 09:58:15 CEST 2017


On Mon, Oct 09, 2017 at 09:19:21AM +0200, Alexandre Derumier wrote:
> 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

you can just do the same using "systemctl edit ksmtuned", and adding
just the following snippet (setting your desired value):

[Service]
ExecStartpre=...

as an extension to the existing unit.

it would probably make more sense to just set the sysctl value
persistently though?

in any case, this is IMHO not something that belongs into packaging, but
is a local configuration issue.

> ---
>  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
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list