1
0
Fork 0
tuned/profiles/realtime-virtual-host/script.sh
Luiz Capitulino 03449e60f9 tuned: disable KSM in KVM low-latency profiles
KSM is enabled by default when the qemu-kvm-common-rhev package is
installed. We don't want KSM to run in KVM-RT nor cpu-partitioning
hosts, as it can cause spikes or packet drops.

This series disables KSM in those profiles when they are activated.
Likewise, we re-enable KSM when the profile is de-activated in
case it's enabled by default in systemd.

Luiz Capitulino (3):
  profiles: functions: add functions to disable/enable KSM
  realtime-virtual-host: disable KSM
  cpu-partitioning: disable KSM

 profiles/cpu-partitioning/script.sh      |  2 ++
 profiles/functions                       | 37 ++++++++++++++++++++++++++++++++
 profiles/realtime-virtual-host/script.sh |  3 +++
 3 files changed, 42 insertions(+)

--
2.9.5
Return-Path: lcapitulino@redhat.com
Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO
 zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by
 zmail22.collab.prod.int.phx2.redhat.com with LMTP; Tue, 3 Oct 2017 15:54:02
 -0400 (EDT)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 46F2FD0310
	for <jskarvad@mail.corp.redhat.com>; Tue,  3 Oct 2017 15:54:02 -0400 (EDT)
Received: by smtp.corp.redhat.com (Postfix)
	id 3FBC860F82; Tue,  3 Oct 2017 19:54:02 +0000 (UTC)
Delivered-To: jskarvad@redhat.com
Received: from localhost (ovpn-117-159.phx2.redhat.com [10.3.117.159])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 3A51A60F81;
	Tue,  3 Oct 2017 19:53:59 +0000 (UTC)
From: Luiz Capitulino <lcapitulino@redhat.com>
To: jskarvad@redhat.com
Cc: kvm-rt@redhat.com
Subject: [PATCH 1/3] profiles: functions: add functions to disable/enable KSM
Date: Tue,  3 Oct 2017 15:53:50 -0400
Message-Id: <20171003195352.22910-2-lcapitulino@redhat.com>
In-Reply-To: <20171003195352.22910-1-lcapitulino@redhat.com>
References: <20171003195352.22910-1-lcapitulino@redhat.com>
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12

They will be used by the next commits.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2017-10-10 14:00:28 +02:00

69 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
. /usr/lib/tuned/functions
ltanfile=/sys/module/kvm/parameters/lapic_timer_advance_ns
start() {
python /usr/libexec/tuned/defirqaffinity.py "remove" "$TUNED_isolated_cores_expanded" &&
retval = "$?"
if [ ! $retval -eq 0 ]; then
return $retval
fi
setup_kvm_mod_low_latency
if [ -f lapic_timer_adv_ns.cpumodel ]; then
curmodel=`cat /proc/cpuinfo | grep "model name" | cut -f 2 -d ":" | uniq`
genmodel=`cat lapic_timer_adv_ns.cpumodel`
if [ "$curmodel" != "$genmodel" ]; then
rm -f lapic_timer_adv_ns
rm -f lapic_timer_adv_ns.cpumodel
fi
fi
if [ -f $ltanfile -a ! -f ./lapic_timer_adv_ns ]; then
if [ -f /usr/share/qemu-kvm/tscdeadline_latency.flat ]; then
tempdir=`mktemp -d`
isolatedcpu=`echo "$TUNED_isolated_cores_expanded" | cut -f 1 -d ","`
sh ./run-tscdeadline-latency.sh $isolatedcpu > $tempdir/lat.out
sh ./find-lapictscdeadline-optimal.sh $tempdir/lat.out > $tempdir/opt.out
if [ $? -eq 0 ]; then
echo `cat $tempdir/opt.out | cut -f 2 -d ":"` > ./lapic_timer_adv_ns
curmodel=`cat /proc/cpuinfo | grep "model name" | cut -f 2 -d ":" | uniq`
echo "$curmodel" > lapic_timer_adv_ns.cpumodel
fi
fi
fi
if [ -f $ltanfile -a -f ./lapic_timer_adv_ns ]; then
echo `cat ./lapic_timer_adv_ns` > $ltanfile
fi
disable_ksm
return $retval
}
stop() {
[ "$1" = "full_rollback" ] && teardown_kvm_mod_low_latency
python /usr/libexec/tuned/defirqaffinity.py "add" "$TUNED_isolated_cores_expanded"
enable_ksm
return "$?"
}
verify() {
python /usr/libexec/tuned/defirqaffinity.py "verify" "$TUNED_isolated_cores_expanded"
retval = "$?"
if [ $retval -eq 0 -a -f /sys/module/kvm/parameters/kvmclock_periodic_sync ]; then
retval = `cat /sys/module/kvm/parameters/kvmclock_periodic_sync`
fi
if [ $retval -eq 0 -a -f /sys/module/kvm_intel/parameters/ple_gap ]; then
retval = `cat /sys/module/kvm_intel/parameters/ple_gap`
fi
return $retval
}
process $@