]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-setup: kernel threads can reside in arbitrary cgroups
authorMike Yuan <me@yhndnzj.com>
Tue, 30 Jul 2024 18:35:10 +0000 (20:35 +0200)
committerMike Yuan <me@yhndnzj.com>
Fri, 2 Aug 2024 14:36:08 +0000 (16:36 +0200)
Realistically this doesn't matter, as cg_migrate() is only
used to populate init.scope. But it's probably better to
make things clear.

src/shared/cgroup-setup.c

index 629277736970753518574d20ad85ee22d5521812..cf7a0eb27201cb36d3bf022b0101c303b8b863db 100644 (file)
@@ -639,10 +639,7 @@ int cg_migrate(
                         if (set_contains(s, PID_TO_PTR(pid)))
                                 continue;
 
-                        /* Ignore kernel threads. Since they can only exist in the root cgroup, we only
-                         * check for them there. */
-                        if (cfrom && empty_or_root(pfrom) &&
-                            pid_is_kernel_thread(pid) > 0)
+                        if (pid_is_kernel_thread(pid) > 0)
                                 continue;
 
                         r = cg_attach(cto, pto, pid);