[systemd-devel] Memory in systemctl status
Benjamin Berg
benjamin at sipsolutions.net
Mon Sep 28 11:55:03 UTC 2020
On Mon, 2020-09-28 at 11:37 +0200, Reindl Harald wrote:
>
> Am 28.09.20 um 11:19 schrieb Benjamin Berg:
> > > if i would set "MemoryMax" to 4G "Memory: 8.6G" would kill it
> > > when the
> > > caches are accounted in that context
> >
> > No, the kernel kicks in and reclaims memory at that point. Which can
> > mean either swapping or just dropping caches.
>
> caches have *nothing* to do with the service itself
They really do. Try running multiple concurrent services that are
actually competing for limited memory resources. Caches are only boring
as long as you have plenty of extra memory available so that there is
no competition for it.
> > It really sounds to me like ulimit fits better what you are trying to
> > do. That is available through Limit*=, see systemd.exec.
>
> hell first i want a output in "systemctl status whatever" which is true
> and don't contain a ISO image downloaded by someone two days ago
The output does not match your expectation. But that really doesn't
mean it is false. If you really want more detail, then have a look at
/sys/fs/cgroup/system.slice/httpd.service/memory.stat
but
/sys/fs/cgroup/system.slice/httpd.service/memory.current
really is important. It is the one that tells you how much system
memory is used by the kernel to keep the service running.
Benjamin
> not more and not less
>
> httpd don't use 8.7 GB RAM - period
>
> the only interesting memory is RES of all the processes
>
> my Firefox on the desktop don't use 32 GB RAM even when VIRT shows that
> and even if the latest download of a 10 GB file is somewhere in the OS
> caches in case it's opened later - it's *free* memory
>
> Main PID: 713 (httpd)
> Tasks: 16 (limit: 1024)
> Memory: 8.7G
> CPU: 2h 24min 14.348s
> CGroup: /system.slice/httpd.service
> ├─ 713 /usr/sbin/httpd -D FOREGROUND
> ├─2435242 /usr/sbin/httpd -D FOREGROUND
> ├─2435243 /usr/sbin/httpd -D FOREGROUND
> ├─2435931 /usr/sbin/httpd -D FOREGROUND
> ├─2435942 /usr/sbin/httpd -D FOREGROUND
> ├─2435944 /usr/sbin/httpd -D FOREGROUND
> ├─2435947 /usr/sbin/httpd -D FOREGROUND
> ├─2435948 /usr/sbin/httpd -D FOREGROUND
> ├─2435952 /usr/sbin/httpd -D FOREGROUND
> ├─2435954 /usr/sbin/httpd -D FOREGROUND
> ├─2435960 /usr/sbin/httpd -D FOREGROUND
> ├─2435966 /usr/sbin/httpd -D FOREGROUND
> ├─2435968 /usr/sbin/httpd -D FOREGROUND
> ├─2435969 /usr/sbin/httpd -D FOREGROUND
> ├─2435970 /usr/sbin/httpd -D FOREGROUND
> └─2435972 /usr/sbin/httpd -D FOREGROUND
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200928/19cdbbbe/attachment.sig>
More information about the systemd-devel
mailing list