Currently, for units whose CGRuntime is not allocated just yet, e.g.
inactive ones, MemoryAvailable fails to account for their MemoryMax/High
settings. Let's remove the CGRuntime check hence. The call to
unit_get_memory_accounting() would certainly fail, but it doesn't matter,
since 'current' is initially set to 0 anyways.
if (!unit_context)
return -ENODATA;
- CGroupRuntime *crt = unit_get_cgroup_runtime(u);
- if (!crt || !crt->cgroup_path)
- continue;
-
(void) unit_get_memory_accounting(u, CGROUP_MEMORY_CURRENT, ¤t);
/* in case of error, previous current propagates as lower bound */