Skip to content
Snippets Groups Projects
Commit 4f958b0b authored by Miguel Di Ciurcio Filho's avatar Miguel Di Ciurcio Filho Committed by Guido Trotter
Browse files

kvm: Introduce support for -mem-path


Using hugepages, KVM instances can get a good performance boost. To
activate that, we need to pass the -mem-path argument to KVM along with
the mount point of the hugetlbfs file system on the node.

For the sake of memory availability computation, we use the -mem-prealloc
argument when enabling hugepages, so KVM will reserve all hugepages it
needs when it starts. This avoids allocating an instance on a node that
will not have enough pages in case other instance needs more than what
is available after it boots.

Signed-off-by: default avatarMiguel Di Ciurcio Filho <miguel.filho@gmail.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 87b2cd45
No related branches found
No related tags found
No related merge requests found
......@@ -558,6 +558,7 @@ HV_KVM_FLAG = "kvm_flag"
HV_VHOST_NET = "vhost_net"
HV_KVM_USE_CHROOT = "use_chroot"
HV_CPU_MASK = "cpu_mask"
HV_MEM_PATH = "mem_path"
HVS_PARAMETER_TYPES = {
HV_BOOT_ORDER: VTYPE_STRING,
......@@ -594,6 +595,7 @@ HVS_PARAMETER_TYPES = {
HV_VHOST_NET: VTYPE_BOOL,
HV_KVM_USE_CHROOT: VTYPE_BOOL,
HV_CPU_MASK: VTYPE_STRING,
HV_MEM_PATH: VTYPE_STRING,
}
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
......@@ -934,6 +936,7 @@ HVC_DEFAULTS = {
HV_KVM_FLAG: "",
HV_VHOST_NET: False,
HV_KVM_USE_CHROOT: False,
HV_MEM_PATH: "",
},
HT_FAKE: {
},
......
......@@ -205,6 +205,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
hv_base.ParamInSet(False, constants.HT_KVM_FLAG_VALUES),
constants.HV_VHOST_NET: hv_base.NO_CHECK,
constants.HV_KVM_USE_CHROOT: hv_base.NO_CHECK,
constants.HV_MEM_PATH: hv_base.OPT_DIR_CHECK,
}
_MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
......@@ -567,6 +568,11 @@ class KVMHypervisor(hv_base.BaseHypervisor):
root_append.append('console=ttyS0,38400')
kvm_cmd.extend(['-append', ' '.join(root_append)])
mem_path = hvp[constants.HV_MEM_PATH]
if mem_path:
kvm_cmd.extend(["-mem-path", mem_path])
kvm_cmd.extend(["-mem-prealloc"])
mouse_type = hvp[constants.HV_USB_MOUSE]
vnc_bind_address = hvp[constants.HV_VNC_BIND_ADDRESS]
......
......@@ -658,6 +658,19 @@
</listitem>
</varlistentry>
<varlistentry>
<term>mem_path</term>
<listitem>
<simpara>Valid for the KVM hypervisor.</simpara>
<simpara>This option passes the -mem-path argument to kvm with
the path (on the node) to the mount point of the hugetlbfs
file system, along with the -mem-prealloc argument too.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>use_chroot</term>
<listitem>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment