[libvirt] [PATCH 3/8] qemu: Fix memory locking limit calculation

Martin Kletzander mkletzan at redhat.com
Mon Mar 27 12:24:19 UTC 2017


On Thu, Mar 23, 2017 at 07:16:42PM +0100, Andrea Bolognani wrote:
>For guests that use <memoryBacking><locked>, our only option
>is to remove the memory locking limit altogether.
>---
> src/qemu/qemu_domain.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index 2e2ba4f..01681a5 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -6220,10 +6220,13 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
>         goto done;
>     }
>
>-    if (def->mem.locked) {
>-        memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
>-        goto done;
>-    }
>+    /* If the guest wants its memory to be locked, we need to raise the memory
>+     * locking limit so that the OS will not refuse allocation requests;
>+     * however, there is no reliable way for us to figure out how much memory
>+     * the QEMU process will allocate for its own use, so our only way out is
>+     * to remove the limit altogether. Use with extreme care */
>+    if (def->mem.locked)
>+        return VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
>

So there is no way how one can limit the size of the memlock, other than
setting the hard limit?  Are you planning on adding new element to the
domain XML which would allow setting this number as well?

>     if (ARCH_IS_PPC64(def->os.arch) && def->virtType == VIR_DOMAIN_VIRT_KVM) {
>         unsigned long long maxMemory;
>--
>2.7.4
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170327/6e74ce2c/attachment-0001.sig>


More information about the libvir-list mailing list