]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/service.c
core: introduce support for cgroup freezer
authorMichal Sekletár <msekleta@redhat.com>
Wed, 29 Apr 2020 15:53:43 +0000 (17:53 +0200)
committerMichal Sekletár <msekleta@redhat.com>
Thu, 30 Apr 2020 17:02:51 +0000 (19:02 +0200)
commitd9e45bc3abb8adf5a1cb20816ba8f2d2aa65b17e
tree7c7dcdd6e921fc80e1026915c8df2eee3b5f7d71
parent25a1f04c682260bb9b96e25bdf33665d6172db98
core: introduce support for cgroup freezer

With cgroup v2 the cgroup freezer is implemented as a cgroup
attribute called cgroup.freeze. cgroup can be frozen by writing "1"
to the file and kernel will send us a notification through
"cgroup.events" after the operation is finished and processes in the
cgroup entered quiescent state, i.e. they are not scheduled to
run. Writing "0" to the attribute file does the inverse and process
execution is resumed.

This commit exposes above low-level functionality through systemd's DBus
API. Each unit type must provide specialized implementation for these
methods, otherwise, we return an error. So far only service, scope, and
slice unit types provide the support. It is possible to check if a
given unit has the support using CanFreeze() DBus property.

Note that DBus API has a synchronous behavior and we dispatch the reply
to freeze/thaw requests only after the kernel has notified us that
requested operation was completed.
19 files changed:
NEWS
man/systemctl.xml
src/basic/cgroup-util.c
src/basic/cgroup-util.h
src/basic/unit-def.c
src/basic/unit-def.h
src/core/cgroup.c
src/core/cgroup.h
src/core/dbus-manager.c
src/core/dbus-unit.c
src/core/dbus-unit.h
src/core/dbus.c
src/core/scope.c
src/core/service.c
src/core/slice.c
src/core/unit.c
src/core/unit.h
src/libsystemd/sd-bus/bus-common-errors.h
src/systemctl/systemctl.c