[systemd-devel] Memory in systemctl status

Benjamin Berg benjamin at sipsolutions.net
Mon Sep 28 09:19:39 UTC 2020


On Mon, 2020-09-28 at 10:43 +0200, Reindl Harald wrote:
> 
> Am 28.09.20 um 10:37 schrieb Tomasz Torcz:
> > On Mon, Sep 28, 2020 at 10:08:15AM +0200, Reindl Harald wrote:
> > > Am 27.09.20 um 23:39 schrieb Benjamin Berg:
> > > > > > > however, that value makes little to no sense and if that's the same
> > > > > > > value as accounted for "MemoryMax" it's plain wrong
> > > > But it does make sense. File caches are part of the working set of
> > > > memory that a process needs. Setting MemoryMax=/MemoryMin=
> > > > limits/guarantees the size of this working set. These kinds of limits
> > > > or protections would be a lot less meaningful if caches were not
> > > > accounted for.
> > > 
> > > sorry but that is complete nosense
> > > 
> > > caches are freed as soon whatever process asks for RAM and so they are
> > > *not* part of the working set
> > > 
> > > my webserver is killed because it served at monday, tuesday, thursday
> > > and friday 4 different files with 2 GB?
> > 
> > Why "killed", you wrote yourself caches are freed. So are they freed
> > or aren't they?
> 
> 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.

> why should the caches be freed as long as no other process allocates memory?

Because it means different parts of the system are properly isolated
from each other.

> "These kinds of limits or protections would be a lot less meaningful if
> caches were not accounted for" is nonsense - os caches are part of the
> VFS and have nothing to do with protect from a process allocating 10 GB
> private memory which can't be freed other than swap it out

It really sounds to me like ulimit fits better what you are trying to
do. That is available through Limit*=, see systemd.exec.

Benjamin
-------------- 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/e1fc69b3/attachment-0001.sig>


More information about the systemd-devel mailing list