Skip to content

Commit

Permalink
fix proc meminfo cached calculation (netdata#15859)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 committed Aug 21, 2023
1 parent 2fe29f9 commit 56479af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion collectors/proc.plugin/proc_meminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 56479af

Please sign in to comment.