summaryrefslogtreecommitdiff
path: root/src/basic/def.h
diff options
context:
space:
mode:
authorTejun Heo <htejun@fb.com>2016-11-21 14:45:53 -0500
committerSven Eden <yamakuzure@gmx.net>2017-07-17 17:58:35 +0200
commitf000ad56fe2346cc8391eeb684681e707711b3ce (patch)
treec87d454e456ce891cfc3ed25d1adff39d62d2c43 /src/basic/def.h
parent2f30582bd3d00ce582d190ddb379e46e0a67f813 (diff)
core: make hybrid cgroup unified mode keep compat /sys/fs/cgroup/elogind hierarchy
Currently the hybrid mode mounts cgroup v2 on /sys/fs/cgroup instead of the v1 name=elogind hierarchy. While this works fine for elogind itself, it breaks tools which expect cgroup v1 hierarchy on /sys/fs/cgroup/elogind. This patch updates the hybrid mode so that it mounts v2 hierarchy on /sys/fs/cgroup/unified and keeps v1 "name=elogind" hierarchy on /sys/fs/cgroup/elogind for compatibility. elogind itself doesn't depend on the "name=elogind" hierarchy at all. All operations take place on the v2 hierarchy as before but the v1 hierarchy is kept in sync so that any tools which expect it to be there can keep doing so. This allows elogind to take advantage of cgroup v2 process management without requiring other tools to be aware of the hybrid mode. The hybrid mode is implemented by mapping the special elogind controller to /sys/fs/cgroup/unified and making the basic cgroup utility operations - cg_attach(), cg_create(), cg_rmdir() and cg_trim() - also operate on the /sys/fs/cgroup/elogind hierarchy whenever the cgroup2 hierarchy is updated. While a bit messy, this will allow dropping complications from using cgroup v1 for process management a lot sooner than otherwise possible which should make it a net gain in terms of maintainability. v2: Fixed !cgns breakage reported by @evverx and renamed the unified mount point to /sys/fs/cgroup/unified as suggested by @brauner. v3: chown the compat hierarchy too on delegation. Suggested by @evverx. v4: [zj] - drop the change to default, full "legacy" is still the default.
Diffstat (limited to 'src/basic/def.h')
-rw-r--r--src/basic/def.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/basic/def.h b/src/basic/def.h
index 5ef23ff35..8b9ab3190 100644
--- a/src/basic/def.h
+++ b/src/basic/def.h
@@ -33,9 +33,24 @@
* the watchdog pings will keep the loop busy. */
#define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
+/* The default value for the net.unix.max_dgram_qlen sysctl */
+#define DEFAULT_UNIX_MAX_DGRAM_QLEN 512UL
+
+#if 0 /// elogind allows foreign cgroup controllers. (Well, needs them, actually)
+#define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=systemd"
+#define SYSTEMD_CGROUP_CONTROLLER_HYBRID "name=unified"
+#define SYSTEMD_CGROUP_CONTROLLER "_systemd"
+#else
+#ifndef SYSTEMD_CGROUP_CONTROLLER_LEGACY
+# define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=elogind"
+#endif // SYSTEMD_CGROUP_CONTROLLER_LEGACY
+#ifndef SYSTEMD_CGROUP_CONTROLLER_HYBRID
+# define SYSTEMD_CGROUP_CONTROLLER_HYBRID "name=elogind"
+#endif // SYSTEMD_CGROUP_CONTROLLER_HYBRID
#ifndef SYSTEMD_CGROUP_CONTROLLER
-# define SYSTEMD_CGROUP_CONTROLLER "name=elogind"
-#endif
+# define SYSTEMD_CGROUP_CONTROLLER "_elogind"
+#endif // SYSTEMD_CGROUP_CONTROLLER
+#endif // 0
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE