[systemd-devel] Memory in systemctl status

Greg KH gregkh at linuxfoundation.org
Mon Sep 28 12:08:11 UTC 2020


On Mon, Sep 28, 2020 at 11:37:20AM +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

How do you know this?  And why wouldn't they be "charged" to the task
that caused the cache to fill up?  What "should" they do?

If you don't like the current way that Linux manages memory resources
like this, please discuss it with the kernel developers, there's not
much that systemd can do about it, right?

> > 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
> 
> not more and not less
> 
> httpd don't use 8.7 GB RAM - period

Why shouldn't httpd use all the ram it was allowed to, if possible?
What's wrong with that happening if the kernel is still caching those
resources?

If you want to tell httpd to "flush the data from the kernel" after it
is done downloading that ISO image, please modify httpd to do so,
otherwise how is the kernel to know that it isn't to be asked for again
within the next minute or so?

memory management is hard :)

> the only interesting memory is RES of all the processes

Interesting to whom?

> 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

How do you know that Firefox does not tell the kernel to release that
memory after the download finishes?

Best of luck!

greg k-h


More information about the systemd-devel mailing list