After upgrading from Ubuntu 14.04 LTS to 16.04.01 LTS I have noticed that the memory usage reported is incorrect.
uname: uname -a Linux zenhorst 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:41:41 UTC 2016 i686 athlon i686 GNU/Linux
I'm using the monit version from the package manager: 5.16 which I cannot select below. It is possible to upgrade monit when requested since the latest and greatest is quite a bit newer. Would that be in a specific repository for Ubuntu or should I just download the installer from the website?
Memory usage is shown as: 100.0% [16.0 EB]
Logfile shows: mem usage of 100.0% matches resource limit [mem usage>80.0%] Unfortunately that is all that it shows, so no actual calculation information. Is there some debugging I can enable?
After consulting other memory issues reported here I found how memory is calculated:
MemFree + Buffers + Cached + SReclaimable
#385/ #430/ #464 show old "free" memory overview, so not sure if related since this is since 16.04 LTS.
So looking at /proc/meminfo:
cat /proc/meminfo MemTotal: 3586928 kB MemFree: 204660 kB MemAvailable: 2380140 kB Buffers: 178864 kB Cached: 2297752 kB SwapCached: 19700 kB Active: 1064828 kB Inactive: 2181128 kB Active(anon): 384940 kB Inactive(anon): 413360 kB Active(file): 679888 kB Inactive(file): 1767768 kB Unevictable: 3424 kB Mlocked: 3424 kB HighTotal: 2723656 kB HighFree: 48580 kB LowTotal: 863272 kB LowFree: 156080 kB SwapTotal: 15624184 kB SwapFree: 15501108 kB Dirty: 476 kB Writeback: 0 kB AnonPages: 759128 kB Mapped: 75496 kB Shmem: 26524 kB Slab: 100236 kB SReclaimable: 84676 kB SUnreclaim: 15560 kB KernelStack: 3528 kB PageTables: 5128 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 17417648 kB Committed_AS: 2364796 kB VmallocTotal: 122880 kB VmallocUsed: 0 kB VmallocChunk: 0 kB AnonHugePages: 595968 kB CmaTotal: 0 kB CmaFree: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 34808 kB DirectMap2M: 878592 kB
So the usage is not 100%.
Note that in 16.04LTS the memory calculations have changed. For example, the free command no longer contains the buffers/cache line.
free total used free shared buff/cache available Mem: 3586928 778228 198328 26236 2610372 2406888 Swap: 15624184 123428 15500756
As you can see, the buff/cache is not released but seems to be retained like in Java. Top information:
KiB Mem : 3586928 total, 201108 free, 776076 used, 2609744 buff/cache KiB Swap: 15624184 total, 15500336 free, 123848 used. 2408724 avail Mem
Detail: swappiness is set to 0, and still it swaps for some reason. This could indicate that Ubuntu 16.04LTS memory calculations are a bit off in the first place.