[systemd-devel] Question regarding memory accounting display behavior related to MemoryAccounting

Matthew Chae Matthew.Chae at axis.com
Wed Oct 2 08:10:04 UTC 2024


Hi Maintainers,

I have a question regarding MemoryAccounting.

MemoryAccounting is described as follows:
MemoryAccounting=
    This setting controls the memory controller in the unified hierarchy.
    Turn on process and kernel memory accounting for this unit. Takes a boolean argument. Note that turning on memory accounting for one unit will also implicitly turn it on for all units contained in the same slice and for all its parent slices and the units contained therein.
https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html#MemoryAccounting=


Here are my questions below.

First, as mentioned above, systemd-cgtop shows memory accounting for each service in a slice, even if only one service in the slice has MemoryAccounting=yes.
However, when running "systemctl status", memory accounting is only displayed for services with MemoryAccounting=yes, as shown in the first image below.
Other services in the same slice do not display memory accounting, as shown in the second image below. Is there any specific reason for this behavior? According to the description of MemoryAccounting above, shouldn't other services also display memory accounting when running "systemctl status"?

[cid:54769a56-4d19-47a0-823c-4a0b894d8d51]

[cid:a5efc6f4-54b6-4c2f-8566-c6e1018a7fb1]


Second, shouldn't systemd-cgtop display not only the value of memory.current, like systemctl status does, but also memory.peak, which is part of cgroup memory accounting?


Thanks,
Matthew Chae
Axis Communications,
Lund, Sweden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20241002/de39f5a9/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 45764 bytes
Desc: image.png
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20241002/de39f5a9/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 72467 bytes
Desc: image.png
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20241002/de39f5a9/attachment-0003.png>


More information about the systemd-devel mailing list