[systemd-devel] Memory in systemctl status

Benjamin Berg benjamin at sipsolutions.net
Sun Sep 27 21:39:19 UTC 2020


On Sun, 2020-09-27 at 17:45 +0200, Reindl Harald wrote:
> 
> Am 27.09.20 um 14:08 schrieb Greg KH:
> > On Sun, Sep 27, 2020 at 01:41:33PM +0200, Reindl Harald wrote:
> > > Memory: 8.6G
> > > 
> > > looks like there is a large part of os-caching included where i wonmder
> > > how that's done because a file can be read by muliple processes /
> > > services and is hopfefully only once cached

I believe it is generally accounted against the cgroup that caused it
to be read into main memory. The cgroup documentation probably has more
details.

> > > 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.

Benjamin

> > > [root at arrakis:~]$ free
> > >               total        used        free      shared  buff/cache
> > > available
> > > Mem:           15Gi       2.2Gi       585Mi       309Mi        12Gi
> > >    12Gi
> > > Swap:            0B          0B          0B
> > 
> > The kernel does this, it's nothing to do with systemd or anything else.
> > 
> > You can get "back" that memory for a short while if you really want it
> > by doing:
> > 	echo 3 > /proc/sys/vm/drop_caches
> > 
> > For more details, see https://www.linuxatemyram.com/
> 
> you completly miss the point and should not cut in the middle of a post!
> 
> Memory: 8.6G
> 
> *no* httpd don't consume 8.6GB RAM
> 
> the question is *why* systemd takes the os-cache into account of the
> memory a service is using
> 
> [root at arrakis:~]$ systemctl status httpd.service
> ● httpd.service - Apache Webserver
>    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled;
> vendor preset: disabled)
>   Drop-In: /etc/systemd/system/httpd.service.d
>            └─lockdown.conf
>    Active: active (running) since Sun 2020-09-20 07:53:39 CEST; 1 weeks
> 0 days ago
>   Process: 1935633 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
> (code=exited, status=0/SUCCESS)
>  Main PID: 713 (httpd)
>     Tasks: 17 (limit: 1024)
>    Memory: 8.6G
>       CPU: 2h 8min 5.442s
>    CGroup: /system.slice/httpd.service
>            ├─    713 /usr/sbin/httpd -D FOREGROUND
>            ├─2151772 /usr/sbin/httpd -D FOREGROUND
>            ├─2151803 /usr/sbin/httpd -D FOREGROUND
>            ├─2151805 /usr/sbin/httpd -D FOREGROUND
>            ├─2152130 /usr/sbin/httpd -D FOREGROUND
>            ├─2152132 /usr/sbin/httpd -D FOREGROUND
>            ├─2152188 /usr/sbin/httpd -D FOREGROUND
>            ├─2152189 /usr/sbin/httpd -D FOREGROUND
>            ├─2152199 /usr/sbin/httpd -D FOREGROUND
>            ├─2152211 /usr/sbin/httpd -D FOREGROUND
>            ├─2152213 /usr/sbin/httpd -D FOREGROUND
>            ├─2152214 /usr/sbin/httpd -D FOREGROUND
>            ├─2152215 /usr/sbin/httpd -D FOREGROUND
>            ├─2152217 /usr/sbin/httpd -D FOREGROUND
>            ├─2152220 /usr/sbin/httpd -D FOREGROUND
>            ├─2152756 /usr/sbin/httpd -D FOREGROUND
>            └─2152886 /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/20200927/acccce77/attachment.sig>


More information about the systemd-devel mailing list