]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/main.c
core: make TasksMax a partially dynamic property
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Nov 2019 12:50:28 +0000 (13:50 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 14 Nov 2019 17:41:54 +0000 (18:41 +0100)
commit3a0f06c41a29b760fe6c3da7529cf595e583aa06
treeb17256725338fb223a5a3c4bd15b8d5312a61ec7
parenta650e19820b85e7b82a87508a7f80ce764f2f1a0
core: make TasksMax a partially dynamic property

TasksMax= and DefaultTasksMax= can be specified as percentages. We don't
actually document of what the percentage is relative to, but the implementation
uses the smallest of /proc/sys/kernel/pid_max, /proc/sys/kernel/threads-max,
and /sys/fs/cgroup/pids.max (when present). When the value is a percentage,
we immediately convert it to an absolute value. If the limit later changes
(which can happen e.g. when systemd-sysctl runs), the absolute value becomes
outdated.

So let's store either the percentage or absolute value, whatever was specified,
and only convert to an absolute value when the value is used. For example, when
starting a unit, the absolute value will be calculated when the cgroup for
the unit is created.

Fixes #13419.
12 files changed:
src/basic/cgroup-util.h
src/basic/limits-util.c
src/core/cgroup.c
src/core/cgroup.h
src/core/dbus-cgroup.c
src/core/dbus-cgroup.h
src/core/dbus-manager.c
src/core/load-fragment.c
src/core/main.c
src/core/manager.c
src/core/manager.h
src/test/test-cgroup-mask.c