Bug 1257897 - systemd-cgtop shows memory usage for services with MemoryAccounting=no
systemd-cgtop shows memory usage for services with MemoryAccounting=no
Status: CLOSED CANTFIX
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: systemd-maint
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-28 07:01 EDT by Branislav Blaškovič
Modified: 2015-08-28 07:28 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-28 07:28:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Branislav Blaškovič 2015-08-28 07:01:42 EDT
Version-Release number of selected component (if applicable):
systemd-219-11.el7.x86_64

Description of problem:
If I take a look at systemd-cgtop I can see that we are not counting memory consuption for any slice:

Path                                                                            Tasks   %CPU   Memory  Input/s Output/s
/                                                                                  89    0.7   212.2M        -        -
/system.slice/ModemManager.service                                                  1      -        -        -        -
/system.slice/NetworkManager.service                                                2      -        -        -        -
/system.slice/auditd.service                                                        1      -        -        -        -
/system.slice/avahi-daemon.service                                                  2      -        -        -        -
/system.slice/crond.service                                                         1      -        -        -        -
/system.slice/dbus.service                                                          1      -        -        -        -
/system.slice/gssproxy.service                                                      1      -        -        -        -
/system.slice/lvm2-lvmetad.service                                                  1      -        -        -        -
/system.slice/polkit.service                                                        1      -        -        -        -
/system.slice/postfix.service                                                       3      -        -        -        -
/system.slice/rhnsd.service                                                         1      -        -        -        -
/system.slice/rhsmcertd.service                                                     1      -        -        -        -
/system.slice/rpc-statd.service                                                     1      -        -        -        -
/system.slice/rpcbind.service                                                       1      -        -        -        -
/system.slice/rsyslog.service                                                       1      -        -        -        -
/system.slice/sshd.service                                                          1      -        -        -        -
/system.slice/system-getty.slice/getty@tty1.service                                 1      -        -        -        -
/system.slice/system-serial\x2dgetty.slice/serial-getty@ttyS0.service               1      -        -        -        -
/system.slice/systemd-journald.service                                              1      -        -        -        -
/system.slice/systemd-logind.service                                                1      -        -        -        -
/system.slice/systemd-udevd.service                                                 1      -        -        -        -
/system.slice/tuned.service                                                         1      -        -        -        -
/system.slice/wpa_supplicant.service                                                1      -        -        -        -
/user.slice/user-0.slice/session-3.scope                                            1      -        -        -        -
/user.slice/user-0.slice/session-4.scope                                            4      -        -        -        -

Then I set MemoryAccounting for sshd in its service file, restart it and run systemd-cgtop again:

Path                                                                            Tasks   %CPU   Memory  Input/s Output/s
/                                                                                  90    1.3   217.6M        -        -
/system.slice                                                                       -      -   948.0K        -        -
/system.slice/ModemManager.service                                                  1      -        -        -        -
/system.slice/NetworkManager.service                                                2      -     4.0K        -        -
/system.slice/auditd.service                                                        1      -     4.0K        -        -
/system.slice/avahi-daemon.service                                                  2      -        -        -        -
/system.slice/crond.service                                                         1      -        -        -        -
/system.slice/dbus.service                                                          1      -        -        -        -
/system.slice/gssproxy.service                                                      1      -        -        -        -
/system.slice/lvm2-lvmetad.service                                                  1      -        -        -        -
/system.slice/polkit.service                                                        1      -        -        -        -
/system.slice/postfix.service                                                       3      -        -        -        -
/system.slice/rhnsd.service                                                         1      -        -        -        -
/system.slice/rhsmcertd.service                                                     1      -        -        -        -
/system.slice/rpc-statd.service                                                     1      -        -        -        -
/system.slice/rpcbind.service                                                       1      -        -        -        -
/system.slice/rsyslog.service                                                       1      -     4.0K        -        -
/system.slice/sshd.service                                                          1      -   856.0K        -        -
/system.slice/system-getty.slice/getty@tty1.service                                 1      -        -        -        -
/system.slice/system-serial\x2dgetty.slice/serial-getty@ttyS0.service               1      -        -        -        -
/system.slice/systemd-journald.service                                              1      -    80.0K        -        -
/system.slice/systemd-logind.service                                                1      -        -        -        -
/system.slice/systemd-udevd.service                                                 1      -        -        -        -
/system.slice/tuned.service                                                         1      -        -        -        -
/system.slice/wpa_supplicant.service                                                1      -        -        -        -
/user.slice/user-0.slice/session-3.scope                                            1      -        -        -        -
/user.slice/user-0.slice/session-4.scope                                            4      -        -        -        -

This is weird, because it's counting memory for auditd, NetworkManager and others. But they don't have MemoryAccounting:

# systemctl show auditd.service | grep MemoryAccounting
MemoryAccounting=no
# systemctl show NetworkManager.service | grep MemoryAccounting
MemoryAccounting=no

In systemd-cgtop man page [1] is:
    unless "CPUAccounting=1", "MemoryAccounting=1" and "BlockIOAccounting=1" are enabled for the services in question, no resource accounting will be available for system services and the data shown by systemd-cgtop will be incomplete

[1] http://www.freedesktop.org/software/systemd/man/systemd-cgtop.html
Comment 2 Lukáš Nykrýn 2015-08-28 07:28:12 EDT
This is basically expected, if you turn on memory accounting for one service, whole slice will have memory accounting due to cgroup implementation.
http://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#MemoryAccounting=

Then every new proccess in such slice will have memory accounting (try to restart crond).

Note You need to log in before you can comment on or make changes to this bug.