[systemd-devel] systemctl show outputs incorrect MemoryCurrent value

George Xie georgexsh at gmail.com
Tue Jul 24 12:12:34 UTC 2018


on box A, systemctl show outputs an incorrect value for unit memory usage:

    [box A] $ systemctl show crond | grep MemoryCurrent
    MemoryCurrent=18446744073709551615

18446744073709551615 == UINT64_MAX, this must be incorrect.

another box B with the similar setup could get correct memory usage:

    [box B] $ systemctl show crond | grep MemoryCurrent
    MemoryCurrent=1490944

both machine use CentOS7 and pre-shipped systemd 219:

    # systemctl --version
    systemd 219
    +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS
+KMOD +IDN

I've traced systemctl.c in SRPM, it looks like the output of
`MemoryCurrent` is directly from `property_get_current_memory()` via sdbus,
which is read from
"/sys/fs/cgroup/memory/system.slice/crond.service/memory.usage_in_bytes",
box B has this path but box A doesn't. I guess this the root cause, but no
idea why there is no such cgroup virtual path.

how could I make systemctl/systemd get correct memory usage?


--
Xie Shi
http://xerr.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180724/3ba25373/attachment.html>


More information about the systemd-devel mailing list