From f273bfd0837b955941462535d66a0c4076948ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 9 Feb 2021 15:57:22 +0100 Subject: [PATCH] Linux: restore memory calculation regarding HugePages Subtract the total amount of huge page memory from total and used memory. Restores behavior from #450 (see also #447) Follow-up of 3d497a37 --- linux/Platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/Platform.c b/linux/Platform.c index 83c62d32..da2ae606 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -283,8 +283,8 @@ void Platform_setMemoryValues(Meter* this) { const ProcessList* pl = this->pl; const LinuxProcessList* lpl = (const LinuxProcessList*) pl; - this->total = pl->totalMem; - this->values[0] = pl->usedMem; + this->total = pl->totalMem > lpl->totalHugePageMem ? pl->totalMem - lpl->totalHugePageMem : pl->totalMem; + this->values[0] = pl->usedMem > lpl->totalHugePageMem ? pl->usedMem - lpl->totalHugePageMem : pl->usedMem; this->values[1] = pl->buffersMem; this->values[2] = pl->cachedMem; this->values[3] = pl->availableMem;