[virt-tools-list] [PATCH] To support huge-sized page

Cole Robinson crobinso at redhat.com
Tue Nov 29 16:21:11 UTC 2011


On 11/29/2011 05:58 AM, y at zhlbj-host.collab.prod.int.phx2.redhat.com wrote:
> From: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> 
> On some CPU architectures, huge-sized page are supported for
> performance boost. However, virt-manager doesn't support the
> feature of huge-sized page explicitly.
> 
> The patch is addressing the issue. Support of huge-sized page
> will be implemented in the Guest object so that the virt-manager
> can configure.
> 
> Signed-off-by: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> ---
>  virtinst/Guest.py |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/virtinst/Guest.py b/virtinst/Guest.py
> index 46ec340..a5d2e56 100644
> --- a/virtinst/Guest.py
> +++ b/virtinst/Guest.py
> @@ -190,6 +190,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
>          self._uuid = None
>          self._memory = None
>          self._maxmemory = None
> +        self._hugepage = None
>          self._vcpus = 1
>          self._maxvcpus = 1
>          self._cpuset = None
> @@ -343,6 +344,14 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
>                                xpath="./memory",
>                                get_converter=lambda s, x: int(x) / 1024,
>                                set_converter=lambda s, x: int(x) * 1024)
> +    def get_hugepage(self):
> +        return self._hugepage
> +    def set_hugepage(self, val):
> +        if val is None:
> +            return val
> +        self._hugepage = bool(val)
> +    hugepage = _xml_property(get_hugepage, set_hugepage,
> +                             xpath="./memoryBacking/hugepages", is_bool=True)
>  
>      # UUID for the guest
>      def get_uuid(self):
> @@ -1044,9 +1053,14 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
>          xml = add(desc_xml)
>          xml = add("  <memory>%s</memory>" % (self.maxmemory * 1024))
>          xml = add("  <currentMemory>%s</currentMemory>" % (self.memory * 1024))
> +
>          # <blkiotune>
>          # <memtune>
> -        # <memoryBacking>
> +        if self.hugepage is True:
> +            xml = add("  <memoryBacking>")
> +            xml = add("    <hugepages/>")
> +            xml = add("  </memoryBacking>")
> +
>          xml = add(self._get_vcpu_xml())
>          # <cputune>
>          xml = add(self.numatune.get_xml_config())

Please add some basic tests for this. set this value in
tests/xmlconfig.py:testManyDevices and tests/xmlparse.py:testAlterGuest
so we protect XML generation against basic regressions.

Thanks,
Cole




More information about the virt-tools-list mailing list