1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-01 08:58:29 +03:00

Merge pull request from poettering/cgroup-cpu-acct-fixes

cgroup cpuacct controller handling fixes
This commit is contained in:
Lennart Poettering 2018-12-10 18:27:28 +01:00 committed by GitHub
commit 52da1a8b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions
TODO
src/core

7
TODO

@ -23,6 +23,13 @@ Janitorial Clean-ups:
Features:
* make MAINPID= message reception checks even stricter: if service uses User=,
then check sending UID and ignore message if it doesn't match the user or
root.
* maybe trigger a uevent "change" on a device if "systemctl reload xyz.device"
is issued.
* when importing an fs tree with machined, optionally apply userns-rec-chown
* when importing an fs tree with machined, complain if image is not an OS

@ -2844,23 +2844,22 @@ static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
if (unit_has_host_root_cgroup(u))
return procfs_cpu_get_usage(ret);
r = cg_all_unified();
if (r < 0)
return r;
/* Requisite controllers for CPU accounting are not enabled */
if ((get_cpu_accounting_mask() & ~u->cgroup_realized_mask) != 0)
return -ENODATA;
r = cg_all_unified();
if (r < 0)
return r;
if (r > 0) {
_cleanup_free_ char *val = NULL;
uint64_t us;
r = cg_get_keyed_attribute("cpu", u->cgroup_path, "cpu.stat", STRV_MAKE("usage_usec"), &val);
if (r < 0)
return r;
if (IN_SET(r, -ENOENT, -ENXIO))
return -ENODATA;
if (r < 0)
return r;
r = safe_atou64(val, &us);
if (r < 0)