chiark / gitweb /
cgroup: never migrate kernel threads out of the root cgroup
authorLennart Poettering <lennart@poettering.net>
Tue, 1 Sep 2015 15:53:14 +0000 (17:53 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:19:06 +0000 (10:19 +0100)
It won't work anyway.

src/basic/cgroup-util.c

index b3e92763cde20ca9526f83b2dfce79319f51f1d0..f96cd6339402e8182c32f00349dad11b2d704149 100644 (file)
@@ -321,6 +321,14 @@ int cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char
                         if (set_get(s, LONG_TO_PTR(pid)) == LONG_TO_PTR(pid))
                                 continue;
 
+                        /* Ignore kernel threads. Since they can only
+                         * exist in the root cgroup, we only check for
+                         * them there. */
+                        if (cfrom &&
+                            (isempty(pfrom) || path_equal(pfrom, "/")) &&
+                            is_kernel_thread(pid) > 0)
+                                continue;
+
                         r = cg_attach(cto, pto, pid);
                         if (r < 0) {
                                 if (ret >= 0 && r != -ESRCH)