[PATCH v1 3/5] qemu: Move @prealloc into qemuBuildMemoryGetPagesize()
Ján Tomko
jtomko at redhat.com
Wed Jan 19 14:31:26 UTC 2022
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 at redhat.com>
>---
> 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;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220119/bd9cb0e1/attachment-0001.sig>
More information about the libvir-list
mailing list