diff --git a/src/lxc/virtlxcd.service.in b/src/lxc/virtlxcd.service.in
index c732499a64..33f8ca2d4d 100644
--- a/src/lxc/virtlxcd.service.in
+++ b/src/lxc/virtlxcd.service.in
@@ -32,6 +32,12 @@ LimitNOFILE=8192
 # A conservative default of 8 tasks per guest results in a TasksMax of
 # 32k to support 4096 guests.
 TasksMax=32768
+# With cgroups v2 there is no devices controller anymore, we have to use
+# eBPF to control access to devices.  In order to do that we create a eBPF
+# hash MAP which locks memory.  The default map size for 64 devices together
+# with program takes 12k per guest.  After rounding up we will get 64M to
+# support 4096 guests.
+LimitMEMLOCK=64M
 
 [Install]
 WantedBy=multi-user.target
diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
index 44eb2a2bf7..aa24bdaab7 100644
--- a/src/qemu/virtqemud.service.in
+++ b/src/qemu/virtqemud.service.in
@@ -32,6 +32,12 @@ LimitNOFILE=8192
 # A conservative default of 8 tasks per guest results in a TasksMax of
 # 32k to support 4096 guests.
 TasksMax=32768
+# With cgroups v2 there is no devices controller anymore, we have to use
+# eBPF to control access to devices.  In order to do that we create a eBPF
+# hash MAP which locks memory.  The default map size for 64 devices together
+# with program takes 12k per guest.  After rounding up we will get 64M to
+# support 4096 guests.
+LimitMEMLOCK=64M
 
 [Install]
 WantedBy=multi-user.target
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 9c8c54a2ef..90b2cad5b0 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -40,6 +40,12 @@ LimitNOFILE=8192
 # A conservative default of 8 tasks per guest results in a TasksMax of
 # 32k to support 4096 guests.
 TasksMax=32768
+# With cgroups v2 there is no devices controller anymore, we have to use
+# eBPF to control access to devices.  In order to do that we create a eBPF
+# hash MAP which locks memory.  The default map size for 64 devices together
+# with program takes 12k per guest.  After rounding up we will get 64M to
+# support 4096 guests.
+LimitMEMLOCK=64M
 
 [Install]
 WantedBy=multi-user.target