On Fri, Oct 1, 2010 at 2:58 PM, Miguel Di Ciurcio Filho
<[email protected]> wrote:

Hi,

> Using transparent 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: Miguel Di Ciurcio Filho <[email protected]>

Thanks for sending this patch. LGTM, for devel-2.2. Small
notes/discussion items below:

> ---
>  lib/constants.py         |    3 +++
>  lib/hypervisor/hv_kvm.py |    6 ++++++
>  man/gnt-instance.sgml    |   13 +++++++++++++
>  3 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/lib/constants.py b/lib/constants.py
> index 114cf91..8169646 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -566,6 +566,7 @@ HV_KVM_FLAG = "kvm_flag"
>  HV_VHOST_NET = "vhost_net"
>  HV_KVM_USE_CHROOT = "use_chroot"
>  HV_CPU_MASK = "cpu_mask"
> +HV_HUGEPAGES_PATH = "hugepages_path"
>

Should this be hugepages_path or mem_path?

>  HVS_PARAMETER_TYPES = {
>   HV_BOOT_ORDER: VTYPE_STRING,
> @@ -602,6 +603,7 @@ HVS_PARAMETER_TYPES = {
>   HV_VHOST_NET: VTYPE_BOOL,
>   HV_KVM_USE_CHROOT: VTYPE_BOOL,
>   HV_CPU_MASK: VTYPE_STRING,
> +  HV_HUGEPAGES_PATH: VTYPE_STRING,
>   }
>
>  HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
> @@ -970,6 +972,7 @@ HVC_DEFAULTS = {
>     HV_KVM_FLAG: "",
>     HV_VHOST_NET: False,
>     HV_KVM_USE_CHROOT: False,
> +    HV_HUGEPAGES_PATH: '',

Will change this to "" for the styleguide.

>     },
>   HT_FAKE: {
>     },
> diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
> index d2ac24c..f0b4075 100644
> --- a/lib/hypervisor/hv_kvm.py
> +++ b/lib/hypervisor/hv_kvm.py
> @@ -206,6 +206,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_HUGEPAGES_PATH: hv_base.OPT_DIR_CHECK,
>     }
>
>   _MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
> @@ -566,6 +567,11 @@ class KVMHypervisor(hv_base.BaseHypervisor):
>         root_append.append('console=ttyS0,38400')
>       kvm_cmd.extend(['-append', ' '.join(root_append)])
>
> +    hugepages_path = hvp[constants.HV_HUGEPAGES_PATH]
> +    if hugepages_path:
> +      kvm_cmd.extend(['-mem-path', hugepages_path])
> +      kvm_cmd.extend(['-mem-prealloc'])
> +
>     mouse_type = hvp[constants.HV_USB_MOUSE]
>     vnc_bind_address = hvp[constants.HV_VNC_BIND_ADDRESS]
>
> diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml
> index 9be66b1..fc7afbb 100644
> --- a/man/gnt-instance.sgml
> +++ b/man/gnt-instance.sgml
> @@ -659,6 +659,19 @@
>             </varlistentry>
>
>             <varlistentry>
> +              <term>hugepages_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>
>                 <simpara>Valid for the KVM hypervisor.</simpara>

Thanks,

Guido

Reply via email to