]> git.ipfire.org Git - thirdparty/systemd.git/commit
cgroup: Refactor MemoryAvailable= evaluation
authorMichal Koutný <mkoutny@suse.com>
Thu, 7 Sep 2023 17:27:52 +0000 (19:27 +0200)
committerMichal Koutný <mkoutny@suse.com>
Fri, 8 Sep 2023 17:07:12 +0000 (19:07 +0200)
commit727cea7652c978c5ef2cffa682d163be3a9f7768
treeeb644df0aa09955eba76a3be9119c202d652913b
parent3565c709f587a3d29d412d81355f8dd9d565a39e
cgroup: Refactor MemoryAvailable= evaluation

unit_get_memory_available() duplicates similar logic contained in
unit_get_memory_current(). Instead, it can call it for each unit it
needs data for.
Additionally, simplify the flow by treating all units from leaf to root
uniformly in one loop.

Functional change when a queried unit does not have MemoryAccounting=yes
(or cgroup_path), we will try getting an estimate from ancestors.
src/core/cgroup.c