summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2023-03-15 00:23:05 +0000
committerGitHub <noreply@github.com>2023-03-15 00:23:05 +0000
commita247e95c28a68ae0d79f782f386777843c633ef6 (patch)
tree71f8b1ec6ea52359d6cb97b933b2b187692f0f12 /src
parent85c494f7e79fc015f1ad4ce39bf118d8627c4daa (diff)
parentaf2b151be9cc2002a7c00af75b31ccdaaf8f70eb (diff)
downloadsystemd-a247e95c28a68ae0d79f782f386777843c633ef6.tar.gz
Merge pull request #26808 from keszybz/no-controllers-followup
Docs and dump output follow-up for the case of delegation with no controllers
Diffstat (limited to 'src')
-rw-r--r--src/core/cgroup.c5
-rw-r--r--src/core/load-fragment.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 19469c4ae0..8b178ea29f 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -474,6 +474,9 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
(void) cg_mask_to_string(c->disable_controllers, &disable_controllers_str);
(void) cg_mask_to_string(c->delegate_controllers, &delegate_controllers_str);
+ /* "Delegate=" means "yes, but no controllers". Show this as "(none)". */
+ const char *delegate_str = delegate_controllers_str ?: c->delegate ? "(none)" : "no";
+
cpuset_cpus = cpu_set_to_range_string(&c->cpuset_cpus);
startup_cpuset_cpus = cpu_set_to_range_string(&c->startup_cpuset_cpus);
cpuset_mems = cpu_set_to_range_string(&c->cpuset_mems);
@@ -560,7 +563,7 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
prefix, tasks_max_resolve(&c->tasks_max),
prefix, cgroup_device_policy_to_string(c->device_policy),
prefix, strempty(disable_controllers_str),
- prefix, strempty(delegate_controllers_str),
+ prefix, delegate_str,
prefix, managed_oom_mode_to_string(c->moom_swap),
prefix, managed_oom_mode_to_string(c->moom_mem_pressure),
prefix, PERMYRIAD_AS_PERCENT_FORMAT_VAL(UINT32_SCALE_TO_PERMYRIAD(c->moom_mem_pressure_limit)),
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index f6dd9d5273..f2dc02c0c4 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -3978,12 +3978,12 @@ int config_parse_delegate(
return 0;
}
- /* We either accept a boolean value, which may be used to turn on delegation for all controllers, or turn it
- * off for all. Or it takes a list of controller names, in which case we add the specified controllers to the
- * mask to delegate. */
+ /* We either accept a boolean value, which may be used to turn on delegation for all controllers, or
+ * turn it off for all. Or it takes a list of controller names, in which case we add the specified
+ * controllers to the mask to delegate. Delegate= enables delegation without any controllers. */
if (isempty(rvalue)) {
- /* An empty string resets controllers and set Delegate=yes. */
+ /* An empty string resets controllers and sets Delegate=yes. */
c->delegate = true;
c->delegate_controllers = 0;
return 0;