[libvirt] [PATCH 4/6] qemu: Reduce memlock limit after detaching hostdev

Andrea Bolognani abologna at redhat.com
Wed Nov 18 16:04:55 UTC 2015

On Wed, 2015-11-18 at 16:17 +0100, Peter Krempa wrote:
> > +    /* QEMU might no longer need to lock as much memory, eg. we just detached
> > +     * a VFIO device, so adjust the limit here */
> > +    if (qemuDomainRequiresMlock(vm->def))
> > +        if (virProcessSetMaxMemLock(vm->pid,
> > +                                    qemuDomainGetMlockLimitBytes(vm->def)) < 0)
> > +        VIR_WARN("Failed to adjust locked memory limit");
> > +
> Hmmm, looks like we should reset it to default (64KiB afaik) if it was
> required before and is not required any more. Otherwise we would not
> decrease the limit after unplugging the last VFIO device (on x86).

I agree, and I planned to do something about that in a
follow-up patch as this change alone is already a small
improvement over the status quo.

Would you prefer it if I pulled this patch from the series
for now and posted it again once it supports restoring the
limit back to the default once the last VFIO device has been
removed from the guest? I'd be okay with that.


Andrea Bolognani
Software Engineer - Virtualization Team

More information about the libvir-list mailing list