[libvirt] [PATCH] add flag to enforce hugepage backing of guest RAM

Paolo Bonzini pbonzini at redhat.com
Sun Apr 27 16:29:23 UTC 2014


Il 09/04/2014 17:12, Daniel P. Berrange ha scritto:
> On Tue, Apr 08, 2014 at 03:06:13PM -0300, Marcelo Tosatti wrote:
>> On Mon, Mar 17, 2014 at 09:39:54AM +0000, Daniel P. Berrange wrote:
>>> We recently had a bunch more feature requests around huge page support
>>> in libvirt, so I think it is preferrable not to merge this currently.
>>> We need to examine the broader problem to come up with a coherant
>>> design for the whole problemspace.
>>
>> There is a number of options implemented in the kernel and qemu that
>> should be exposed via libvirt to the user.
>>
>> Can you explain what are the properties to be verified in the coherent
>> design that you mention which are being ignored in the proposed patchset
> 
> Libvirt needs to be able to report huge pages available per NUMA node,
> to report how many of the pages are free, what size they are. Also need
> to consider how we tell QEMU to use hugepages from specific host NUMA
> nodes when launching guests, possibly also mapping those to specific
> guest NUMA nodes. With NUMA there's more policy considerations if
> enough hugepages aren't available, do we fallback to non-hugepages on
> the same numa node, or to hugepages frorm a different numa node. I
> don't believe we're going to be able to solve all this in libvirt alone
> and so I think we're going to need improve QEMU command line args for
> setting up hugepages

Yes, this is already queued for 2.1.  The same backend device in QEMU
is used for both advanced memory placement and memory hotplug.  It
goes something like this:


  -object memory-ram,size=1024M,policy=membind,host-nodes=0,id=ram-node0 \
  -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
  -object memory-ram,size=1024M,policy=interleave,host-nodes=1-3,id=ram-node1 \
  -numa node,nodeid=1,cpus=1,memdev=ram-node1

For a non-NUMA guest, just put a single "-numa node,memdev=ram-node0".  The
defaults will apply.

To simulate the effect of "-mem-path ...", instead of memory-ram you use
"-object memory-file,mem-path=...".


You can see above the properties that control policies for host NUMA nodes.
Other properties (merge, dump, prealloc) handle characteristics of the backend
that previously were split across multiple command-line options.  Notably,
prealloc now will work for mmap-backed RAM, not just for hugetlbfs.

Paolo




More information about the libvir-list mailing list