]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vircgroupv2: properly detect empty tasks
authorPavel Hrdina <phrdina@redhat.com>
Tue, 13 Oct 2020 11:25:22 +0000 (13:25 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 3 Nov 2020 20:26:32 +0000 (21:26 +0100)
With cgroups v2 the file cgroup.procs will never be empty if threading
is enabled as it will always have ID of all processes even if all
threads of the processes are moved to sub-cgroups. If that happens the
file cgroup.threads will be empty.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/vircgroupv2.c

index 285b7675d9ab41cdad096dde177f6c41a7693cfd..65f5cc6bd07d54dace463c4ebedd6b598c609cad 100644 (file)
@@ -521,7 +521,7 @@ virCgroupV2HasEmptyTasks(virCgroupPtr cgroup,
     int ret = -1;
     g_autofree char *content = NULL;
 
-    ret = virCgroupGetValueStr(cgroup, controller, "cgroup.procs", &content);
+    ret = virCgroupGetValueStr(cgroup, controller, "cgroup.threads", &content);
 
     if (ret == 0 && content[0] == '\0')
         ret = 1;