mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
core/cgroup: check root cgroup earlier for unit_get_memory_accounting
(cherry picked from commit d3d035395eeced715c9609aeb8bfac7157dd0aa9)
This commit is contained in:
parent
06c2ee3979
commit
16b12506a6
@ -4529,6 +4529,10 @@ int unit_get_memory_accounting(Unit *u, CGroupMemoryAccountingMetric metric, uin
|
||||
if (!UNIT_CGROUP_BOOL(u, memory_accounting))
|
||||
return -ENODATA;
|
||||
|
||||
/* The root cgroup doesn't expose this information. */
|
||||
if (unit_has_host_root_cgroup(u))
|
||||
return -ENODATA;
|
||||
|
||||
CGroupRuntime *crt = unit_get_cgroup_runtime(u);
|
||||
if (!crt)
|
||||
return -ENODATA;
|
||||
@ -4536,10 +4540,6 @@ int unit_get_memory_accounting(Unit *u, CGroupMemoryAccountingMetric metric, uin
|
||||
/* If the cgroup is already gone, we try to find the last cached value. */
|
||||
goto finish;
|
||||
|
||||
/* The root cgroup doesn't expose this information. */
|
||||
if (unit_has_host_root_cgroup(u))
|
||||
return -ENODATA;
|
||||
|
||||
if (!FLAGS_SET(crt->cgroup_realized_mask, CGROUP_MASK_MEMORY))
|
||||
return -ENODATA;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user