]> git.ipfire.org Git - thirdparty/libvirt.git/commit
daemon: set default memlock limit for systemd service
authorPavel Hrdina <phrdina@redhat.com>
Wed, 26 Feb 2020 12:23:00 +0000 (13:23 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 26 Feb 2020 16:56:49 +0000 (17:56 +0100)
commitb379fee11772976f85e095717602e5e010b95e6e
treebe0cd63459ca71c310d3f7f330ef34d14182a49a
parent366ceeec4b6728041ae15b45c33730ca120922ae
daemon: set default memlock limit for systemd service

The default memlock limit is 64k which is not enough to start a single
VM. The requirements for one VM are 12k, 8k for eBPF map and 4k for eBPF
program, however, it fails to create eBPF map and program with 64k limit.
By testing I figured out that the minimal limit is 80k to start a single
VM with functional eBPF and if I add 12k I can start another one.

This leads into following calculation:

80k as memlock limit worked to start a VM with eBPF which means there
is 68k of lock memory that I was not able to figure out what was using
it.  So to get a number for 4096 VMs:

        68 + 12 * 4096 = 49220

If we round it up we will get 64M of memory lock limit to support 4096
VMs with default map size which can hold 64 entries for devices.

This should be good enough as a sane default and users can change it if
the need to.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1807090

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/lxc/virtlxcd.service.in
src/qemu/virtqemud.service.in
src/remote/libvirtd.service.in