[libvirt PATCH 05/11] systemd: Introduce systemd_service_taskmax_extra

Andrea Bolognani abologna at redhat.com
Mon Oct 2 08:51:20 UTC 2023


Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/ch/meson.build                  | 1 +
 src/ch/virtchd.service.extra.in     | 5 -----
 src/lxc/meson.build                 | 1 +
 src/lxc/virtlxcd.service.extra.in   | 5 -----
 src/meson.build                     | 1 +
 src/qemu/meson.build                | 1 +
 src/qemu/virtqemud.service.extra.in | 5 -----
 src/remote/libvirtd.service.in      | 5 -----
 src/remote/meson.build              | 1 +
 src/virtd.service.tasksmax.extra.in | 6 ++++++
 10 files changed, 11 insertions(+), 20 deletions(-)
 create mode 100644 src/virtd.service.tasksmax.extra.in

diff --git a/src/ch/meson.build b/src/ch/meson.build
index 0760d1f8e1..9eecf8c27f 100644
--- a/src/ch/meson.build
+++ b/src/ch/meson.build
@@ -61,6 +61,7 @@ if conf.has('WITH_CH')
     'service_extra_in': [
       files('virtchd.service.extra.in'),
       systemd_service_limitnofile_extra_in,
+      systemd_service_taskmax_extra_in,
     ],
   }
 
diff --git a/src/ch/virtchd.service.extra.in b/src/ch/virtchd.service.extra.in
index 626cf0a21b..38d820c1af 100644
--- a/src/ch/virtchd.service.extra.in
+++ b/src/ch/virtchd.service.extra.in
@@ -5,11 +5,6 @@ After=remote-fs.target
 
 [Service]
 KillMode=process
-# The cgroups pids controller can limit the number of tasks started by
-# the daemon, which can limit the number of domains for some hypervisors.
-# 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
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
index 0c4d51d8b9..fb1aedb5fc 100644
--- a/src/lxc/meson.build
+++ b/src/lxc/meson.build
@@ -168,6 +168,7 @@ if conf.has('WITH_LXC')
     'service_extra_in': [
       files('virtlxcd.service.extra.in'),
       systemd_service_limitnofile_extra_in,
+      systemd_service_taskmax_extra_in,
     ],
   }
 
diff --git a/src/lxc/virtlxcd.service.extra.in b/src/lxc/virtlxcd.service.extra.in
index 626cf0a21b..38d820c1af 100644
--- a/src/lxc/virtlxcd.service.extra.in
+++ b/src/lxc/virtlxcd.service.extra.in
@@ -5,11 +5,6 @@ After=remote-fs.target
 
 [Service]
 KillMode=process
-# The cgroups pids controller can limit the number of tasks started by
-# the daemon, which can limit the number of domains for some hypervisors.
-# 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
diff --git a/src/meson.build b/src/meson.build
index a9e6b521ee..37239fd969 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -195,6 +195,7 @@ guest_unit_files = []
 #   snippets that are shared by multiple units
 #   can be used in service_extra_in/socket_extra_in (see below)
 systemd_service_limitnofile_extra_in = files('virtd.service.limitnofile.extra.in')
+systemd_service_taskmax_extra_in = files('virtd.service.tasksmax.extra.in')
 
 # virt_daemon_units:
 #   generate libvirt daemon systemd unit files
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 09f79f52ee..b28089aa06 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -187,6 +187,7 @@ if conf.has('WITH_QEMU')
     'service_extra_in': [
       files('virtqemud.service.extra.in'),
       systemd_service_limitnofile_extra_in,
+      systemd_service_taskmax_extra_in,
     ],
   }
 
diff --git a/src/qemu/virtqemud.service.extra.in b/src/qemu/virtqemud.service.extra.in
index 48b349b48a..164f672c08 100644
--- a/src/qemu/virtqemud.service.extra.in
+++ b/src/qemu/virtqemud.service.extra.in
@@ -9,11 +9,6 @@ After=remote-fs.target
 
 [Service]
 KillMode=process
-# The cgroups pids controller can limit the number of tasks started by
-# the daemon, which can limit the number of domains for some hypervisors.
-# 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
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 8dc6df2138..900b734f82 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -33,11 +33,6 @@ ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 KillMode=process
 Restart=on-failure
-# The cgroups pids controller can limit the number of tasks started by
-# the daemon, which can limit the number of domains for some hypervisors.
-# 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
diff --git a/src/remote/meson.build b/src/remote/meson.build
index e2960195f7..898131424f 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -193,6 +193,7 @@ if conf.has('WITH_REMOTE')
       'service_in': files('libvirtd.service.in'),
       'service_extra_in': [
         systemd_service_limitnofile_extra_in,
+        systemd_service_taskmax_extra_in,
       ],
       'name': 'legacy monolithic',
       'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ],
diff --git a/src/virtd.service.tasksmax.extra.in b/src/virtd.service.tasksmax.extra.in
new file mode 100644
index 0000000000..2ea2939425
--- /dev/null
+++ b/src/virtd.service.tasksmax.extra.in
@@ -0,0 +1,6 @@
+[Service]
+# The cgroups pids controller can limit the number of tasks started by
+# the daemon, which can limit the number of domains for some hypervisors.
+# A conservative default of 8 tasks per guest results in a TasksMax of
+# 32k to support 4096 guests.
+TasksMax=32768
-- 
2.41.0



More information about the libvir-list mailing list