Systemd/src
Lennart Poettering efdb02375b core: unified cgroup hierarchy support
This patch set adds full support the new unified cgroup hierarchy logic
of modern kernels.

A new kernel command line option "systemd.unified_cgroup_hierarchy=1" is
added. If specified the unified hierarchy is mounted to /sys/fs/cgroup
instead of a tmpfs. No further hierarchies are mounted. The kernel
command line option defaults to off. We can turn it on by default as
soon as the kernel's APIs regarding this are stabilized (but even then
downstream distros might want to turn this off, as this will break any
tools that access cgroupfs directly).

It is possibly to choose for each boot individually whether the unified
or the legacy hierarchy is used. nspawn will by default provide the
legacy hierarchy to containers if the host is using it, and the unified
otherwise. However it is possible to run containers with the unified
hierarchy on a legacy host and vice versa, by setting the
$UNIFIED_CGROUP_HIERARCHY environment variable for nspawn to 1 or 0,
respectively.

The unified hierarchy provides reliable cgroup empty notifications for
the first time, via inotify. To make use of this we maintain one
manager-wide inotify fd, and each cgroup to it.

This patch also removes cg_delete() which is unused now.

On kernel 4.2 only the "memory" controller is compatible with the
unified hierarchy, hence that's the only controller systemd exposes when
booted in unified heirarchy mode.

This introduces a new enum for enumerating supported controllers, plus a
related enum for the mask bits mapping to it. The core is changed to
make use of this everywhere.

This moves PID 1 into a new "init.scope" implicit scope unit in the root
slice. This is necessary since on the unified hierarchy cgroups may
either contain subgroups or processes but not both. PID 1 hence has to
move out of the root cgroup (strictly speaking the root cgroup is the
only one where processes and subgroups are still allowed, but in order
to support containers nicey, we move PID 1 into the new scope in all
cases.) This new unit is also used on legacy hierarchy setups. It's
actually pretty useful on all systems, as it can then be used to filter
journal messages coming from PID 1, and so on.

The root slice ("-.slice") is now implicitly created and started (and
does not require a unit file on disk anymore), since
that's where "init.scope" is located and the slice needs to be started
before the scope can.

To check whether we are in unified or legacy hierarchy mode we use
statfs() on /sys/fs/cgroup. If the .f_type field reports tmpfs we are in
legacy mode, if it reports cgroupfs we are in unified mode.

This patch set carefuly makes sure that cgls and cgtop continue to work
as desired.

When invoking nspawn as a service it will implicitly create two
subcgroups in the cgroup it is using, one to move the nspawn process
into, the other to move the actual container processes into. This is
done because of the requirement that cgroups may either contain
processes or other subgroups.
2015-09-01 23:52:27 +02:00
..
ac-power
activate tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
analyze analyze: correctly draw the plot for user instances 2015-07-28 01:16:24 +03:00
ask-password
backlight fileio: consolidate write_string_file*() 2015-07-06 19:19:25 -04:00
basic core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
binfmt tree-wide: fix write_string_file() user that should not create files 2015-07-06 19:27:20 -04:00
boot tree-wide: we place the opening bracket on the same line as the function name 2015-08-27 17:48:24 +02:00
bootchart tree-wide: convert bootchart and lldp code to use clock_boottime_or_monotonic() 2015-08-03 17:40:46 +02:00
bus-proxyd Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available" 2015-08-27 16:32:22 +02:00
cgls core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
cgroups-agent sd-bus: introduce new sd_bus_flush_close_unref() call 2015-07-03 19:49:03 +02:00
cgtop core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
compat-libs
core core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
cryptsetup tree-wide: introduce mfree() 2015-07-31 19:56:38 +02:00
dbus1-generator Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available" 2015-08-27 16:32:22 +02:00
debug-generator core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
delta tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
detect-virt
escape escape: fix exit code 2015-07-01 23:46:42 -07:00
firstboot Merge branch 'hostnamectl-dot-v2' 2015-08-05 21:02:41 -04:00
fsck sd-bus: introduce new sd_bus_flush_close_unref() call 2015-07-03 19:49:03 +02:00
fstab-generator swap: use swapon -o 2015-05-25 17:06:15 +02:00
getty-generator core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
gpt-auto-generator gpt-auto-generator: warn on ambiguous blkid probe 2015-08-11 23:38:19 +02:00
hibernate-resume fileio: consolidate write_string_file*() 2015-07-06 19:19:25 -04:00
hostname hostname-util: get rid of unused parameter of hostname_cleanup() 2015-08-05 20:49:21 -04:00
hwdb Revert "hwdb: actually search /run/udev/hwdb.d" 2015-06-09 11:26:06 +02:00
import Merge pull request #998 from vbatts/tar_nosparse_flag 2015-08-26 10:09:11 +02:00
initctl shared: add formats-util.h 2015-04-10 23:54:48 +02:00
journal coredumpctl: Add --directory option for reading alternate journal 2015-08-25 20:06:43 +02:00
journal-remote Bug #944: Deletion of unnecessary checks before a few calls of systemd functions 2015-08-17 10:45:30 +02:00
kernel-install 90-loaderentry.install: fixup BOOT_OPTIONS 2015-06-02 16:10:06 +02:00
libsystemd sd-login: improve error handling 2015-09-01 17:20:56 +02:00
libsystemd-network Merge pull request #1108 from phomes/dont-shadow-globals 2015-09-01 18:33:54 +02:00
libudev libudev: device - fix typo in udev_device_get_sysattr_list_entry() 2015-06-17 22:03:34 +02:00
locale locale: add printf attribute to log_xkb() 2015-08-30 19:21:31 -03:00
login cgroup: drop "ignore_self" argument from cg_is_empty() 2015-09-01 18:37:01 +02:00
machine cgroup: drop "ignore_self" argument from cg_is_empty() 2015-09-01 18:37:01 +02:00
machine-id-commit
machine-id-setup
modules-load modules-load: fix memory leak 2015-05-13 14:07:26 +02:00
network Merge pull request #1108 from phomes/dont-shadow-globals 2015-09-01 18:33:54 +02:00
notify shared: add formats-util.h 2015-04-10 23:54:48 +02:00
nspawn core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
nss-myhostname hostname-util: introduce new is_gateway_hostname() call 2015-08-21 12:07:13 +02:00
nss-mymachines util: make machine_name_is_valid() a macro and move it to hostname-util.h 2015-08-24 22:46:45 +02:00
nss-resolve resolved: rework synthesizing logic 2015-08-21 12:41:08 +02:00
path
quotacheck tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
random-seed random-seed: minor cleanups, in particular when it comes to logging 2015-04-21 18:08:09 +02:00
rc-local-generator
remount-fs tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
reply-password
resolve manager: close hostname fd *after* removing it epoll 2015-08-26 09:42:06 +02:00
resolve-host resolve-host: support parsing numeric interface names 2015-08-24 23:46:24 +02:00
rfkill fileio: consolidate write_string_file*() 2015-07-06 19:19:25 -04:00
run run: enable interactive authorization 2015-09-01 16:43:08 +00:00
shared cgroup: drop "ignore_self" argument from cg_is_empty() 2015-09-01 18:37:01 +02:00
sleep fileio: consolidate write_string_file*() 2015-07-06 19:19:25 -04:00
socket-proxy
sysctl sysctl: reword warning message a bit 2015-08-05 11:02:24 +03:00
system-update-generator
systemctl cgroup: drop "ignore_self" argument from cg_is_empty() 2015-09-01 18:37:01 +02:00
systemd sd-dhcp-server: simplify pool creation 2015-08-31 21:34:58 +02:00
sysusers util: Don't interpret quotes by default in extract_first_word 2015-08-07 15:50:42 +00:00
sysv-generator sysv-generator: fix coding-style 2015-07-01 13:02:58 +02:00
test core: unified cgroup hierarchy support 2015-09-01 23:52:27 +02:00
timedate time-util: add new get_timezone() call to get local timezone 2015-08-26 20:36:42 +02:00
timesync timesyncd: remove RLIMIT_NPROC 2015-07-31 15:33:49 +02:00
tmpfiles util: Don't interpret quotes by default in extract_first_word 2015-08-07 15:50:42 +00:00
tty-ask-password-agent tree-wide: introduce mfree() 2015-07-31 19:56:38 +02:00
udev udev: control - add FIXME comment to remove work-around 2015-08-27 12:57:17 +02:00
update-done update-done: ignore nanosecond file timestamp components, they are not reliable 2015-04-27 17:25:57 +02:00
update-utmp Bug #944: Deletion of unnecessary checks before a few calls of systemd functions 2015-08-17 10:45:30 +02:00
user-sessions user-sessions: fix write_string_file() fallout 2015-07-21 15:59:02 +02:00
vconsole tree-wide: fix write_string_file() user that should not create files 2015-07-06 19:27:20 -04:00
.gitignore
Makefile