From 92a993041a07149a24f20d5f818e9718339fac30 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 Dec 2018 16:08:13 +0100 Subject: [PATCH] cgroup: call cg_all_unified() right before using the result Let's not query it before we actually need it. --- src/core/cgroup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 2dd53191e07..75085607d46 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -2844,14 +2844,13 @@ 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; -- 2.47.3