summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-04-14 18:26:38 +0200
committerBenBE <BenBE@geshi.org>2021-04-22 10:48:15 +0200
commit2d7069feb43bf20a7ad018aa3a11025e1f34c2ec (patch)
tree9730202cde55868777be6b16320aacb781afbb04 /linux/LinuxProcessList.c
parent3db3737d75d3eb6803f4c60aa90ea16fdd2eb9f5 (diff)
Linux: handle Shmem being part of Cached
See https://lore.kernel.org/patchwork/patch/648763/ Do not show twice by subtracting from Cached. Closes: #591
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r--linux/LinuxProcessList.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index f5a35193..55a3b46f 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -1571,11 +1571,15 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
/*
* Compute memory partition like procps(free)
* https://gitlab.com/procps-ng/procps/-/blob/master/proc/sysinfo.c
+ *
+ * Adjustments:
+ * - Shmem in part of Cached (see https://lore.kernel.org/patchwork/patch/648763/),
+ * do not show twice by subtracting from Cached and do not subtract twice from used.
*/
this->totalMem = totalMem;
- this->cachedMem = cachedMem + sreclaimableMem;
+ this->cachedMem = cachedMem + sreclaimableMem - sharedMem;
this->sharedMem = sharedMem;
- const memory_t usedDiff = freeMem + cachedMem + sreclaimableMem + buffersMem + sharedMem;
+ const memory_t usedDiff = freeMem + cachedMem + sreclaimableMem + buffersMem;
this->usedMem = (totalMem >= usedDiff) ? totalMem - usedDiff : totalMem - freeMem;
this->buffersMem = buffersMem;
this->availableMem = availableMem != 0 ? MINIMUM(availableMem, totalMem) : freeMem;

© 2014-2024 Faster IT GmbH | imprint | privacy policy