RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1257897 - systemd-cgtop shows memory usage for services with MemoryAccounting=no
Summary: systemd-cgtop shows memory usage for services with MemoryAccounting=no
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-28 11:01 UTC by Branislav Blaškovič
Modified: 2015-08-28 11:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-28 11:28:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Branislav Blaškovič 2015-08-28 11:01:42 UTC
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                                 1      -        -        -        -
/system.slice/system-serial\x2dgetty.slice/serial-getty               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                                 1      -        -        -        -
/system.slice/system-serial\x2dgetty.slice/serial-getty               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 11:28:12 UTC
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.