Hi Jirka,

Thanks for your answer, but I'm looking for a way to set RLIMIT_MEMLOCK without locking all VM memory.
I'm wondering if there is a way to set RLIMIT_MEMLOCK without using the methods you wrote above.

Regards,
Roy

On Tue, Mar 15, 2016 at 8:02 PM, Jiri Denemark <jdenemar@redhat.com> wrote:
On Fri, Feb 19, 2016 at 23:37:57 +0200, Roy Shterman wrote:
> Yes,
>
> I tried also running it as root user and it also didn't worked.
>
> Do you know where libvirt (or QEMU) gets the value for process MEMLOCK?
> maybe i can change this value in libvirt code?

You can change it by specifying /domain/memtune/hard_limit in domain
XML; see http://libvirt.org/formatdomain.html#elementsMemoryTuning

Libvirt will use the hard_limit value for RLIMIT_MEMLOCK, but only if
needed. So it will be set only if any of the following is true:
    - you are on PPC64
    - the /domain/memoryBacking/locked is set
    - a VFIO device passthrough is used
    - an RDMA migration is initiated.

Jirka