mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
qemu: Only use memory-backend-file with NUMA if needed
If this reminds you of a commit message from around a year ago, it's41c2aa729f
and yes, we're dealing with "the same thing" again. Orf309db1f4d
and it's similar. There is a logic in place that if there is no real need for memory-backend-file, qemuBuildMemoryBackendStr() returns 0. However that wasn't the case with hugepage backing. The reason for that was that we abused the 'pagesize' variable for storing that information, but we should rather have a separate one that specifies whether we really need the new object for hugepage backing. And that variable should be set only if this particular NUMA cell needs special treatment WRT hugepages. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1372153 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> (cherry picked from commit 4372a7845acbc6974f6027ef68e7dd3eeb47f425)
This commit is contained in:
parent
9329ca10f1
commit
46f944c281
@ -5045,6 +5045,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
int ret = -1;
|
||||
virJSONValuePtr props = NULL;
|
||||
bool nodeSpecified = virDomainNumatuneNodeSpecified(def->numa, guestNode);
|
||||
bool needHugepage = !!pagesize;
|
||||
|
||||
*backendProps = NULL;
|
||||
*backendType = NULL;
|
||||
@ -5067,10 +5068,10 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||
|
||||
if (pagesize == 0) {
|
||||
bool thisHugepage = false;
|
||||
|
||||
/* Find the huge page size we want to use */
|
||||
for (i = 0; i < def->mem.nhugepages; i++) {
|
||||
bool thisHugepage = false;
|
||||
|
||||
hugepage = &def->mem.hugepages[i];
|
||||
|
||||
if (!hugepage->nodemask) {
|
||||
@ -5088,6 +5089,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
|
||||
if (thisHugepage) {
|
||||
/* Hooray, we've found the page size */
|
||||
needHugepage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5191,7 +5193,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
}
|
||||
|
||||
/* If none of the following is requested... */
|
||||
if (!pagesize && !userNodeset && !memAccess && !nodeSpecified && !force) {
|
||||
if (!needHugepage && !userNodeset && !memAccess && !nodeSpecified && !force) {
|
||||
/* report back that using the new backend is not necessary
|
||||
* to achieve the desired configuration */
|
||||
ret = 1;
|
||||
|
@ -1,10 +1,8 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu -S -M pc -m 1024 -smp 2 \
|
||||
-object memory-backend-file,id=ram-node0,prealloc=yes,\
|
||||
mem-path=/dev/hugepages2M/libvirt/qemu,size=268435456 \
|
||||
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
|
||||
-object memory-backend-file,id=ram-node1,prealloc=yes,\
|
||||
mem-path=/dev/hugepages2M/libvirt/qemu,size=805306368 \
|
||||
-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
|
||||
-mem-prealloc \
|
||||
-mem-path /dev/hugepages2M/libvirt/qemu \
|
||||
-numa node,nodeid=0,cpus=0,mem=256 \
|
||||
-numa node,nodeid=1,cpus=1,mem=768 \
|
||||
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
||||
-usb -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
|
||||
|
Loading…
Reference in New Issue
Block a user