summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin/proc_meminfo.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-04 08:57:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-04 08:57:49 +0000
commit5f647647b2683875bdbed970d955a9e5123284bd (patch)
tree66dcf1d9f7a60cd19dd9ac410e27d5f6ead521d3 /collectors/proc.plugin/proc_meminfo.c
parentReleasing debian version 1.42.1-1. (diff)
downloadnetdata-5f647647b2683875bdbed970d955a9e5123284bd.tar.xz
netdata-5f647647b2683875bdbed970d955a9e5123284bd.zip
Merging upstream version 1.42.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/proc.plugin/proc_meminfo.c')
-rw-r--r--collectors/proc.plugin/proc_meminfo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/collectors/proc.plugin/proc_meminfo.c b/collectors/proc.plugin/proc_meminfo.c
index cd1ba872c..a357cc782 100644
--- a/collectors/proc.plugin/proc_meminfo.c
+++ b/collectors/proc.plugin/proc_meminfo.c
@@ -230,7 +230,9 @@ int do_proc_meminfo(int update_every, usec_t dt) {
}
// http://calimeroteknik.free.fr/blag/?article20/really-used-memory-on-gnu-linux
- unsigned long long MemCached = Cached + SReclaimable + KReclaimable - Shmem;
+ // KReclaimable includes SReclaimable, it was added in kernel v4.20
+ unsigned long long reclaimable = KReclaimable > 0 ? KReclaimable : SReclaimable;
+ unsigned long long MemCached = Cached + reclaimable - Shmem;
unsigned long long MemUsed = MemTotal - MemFree - MemCached - Buffers;
// The Linux kernel doesn't report ZFS ARC usage as cache memory (the ARC is included in the total used system memory)
if (!inside_lxc_container) {