From 059453c40cc068ac3e0b11e54575ab1cba3d5c71 Mon Sep 17 00:00:00 2001 From: Craig Anderson Date: Wed, 21 Mar 2018 14:46:25 -0400 Subject: [PATCH] Detect and enable hugepage support for QEMU Change-Id: I3284c0f8f8946a36a63871dc57e287fbe7260490 --- libvirt/templates/bin/_libvirt.sh.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libvirt/templates/bin/_libvirt.sh.tpl b/libvirt/templates/bin/_libvirt.sh.tpl index 02ef2994ef..63271f81b2 100644 --- a/libvirt/templates/bin/_libvirt.sh.tpl +++ b/libvirt/templates/bin/_libvirt.sh.tpl @@ -30,6 +30,14 @@ if [[ -c /dev/kvm ]]; then chown root:kvm /dev/kvm fi +if [ -d /sys/kernel/mm/hugepages ]; then + if [ -n "$(grep KVM_HUGEPAGES=0 /etc/default/qemu-kvm)" ]; then + sed -i 's/.*KVM_HUGEPAGES=0.*/KVM_HUGEPAGES=1/g' /etc/default/qemu-kvm + else + echo KVM_HUGEPAGES=1 >> /etc/default/qemu-kvm + fi +fi + if [ -n "${LIBVIRT_CEPH_SECRET_UUID}" ] ; then libvirtd --listen &