Re: [PATCH v1 3/5] qemu: Move @prealloc into qemuBuildMemoryGetPagesize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Wednesday in 2022, Michal Privoznik wrote:
The qemuBuildMemoryGetPagesize() function has everything is needs
to decide whether preallocation is needed or not. Move the logic
from qemuBuildMemoryBackendProps() into
qemuBuildMemoryGetPagesize().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/qemu/qemu_command.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 858aa0211a..9ab2b25fe2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3675,9 +3677,23 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg,
            return -1;
    }

+    if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
+        prealloc = true;
+
+    /* If the NVDIMM is a real device then there's nothing to prealloc.
+     * If anything, we would be only wearing off the device.
+     * Similarly, virtio-pmem-pci doesn't need prealloc either. */
+    if (mem->nvdimmPath && !mem->nvdimmPmem &&
+        mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM)
+        prealloc = true;
+
+    if (useHugepage)
+        prealloc = true;
+

In the old location, the uses of if (useHugepage) were guarded by if
(!mem->nvdimmPath).

Please add the condition here as well.

Jano

    *pagesizeRet = pagesize;
    *needHugepageRet = needHugepage;
    *useHugepageRet = useHugepage;
+    *preallocRet = prealloc;

    return 0;
}

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux