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
This commit is contained in:
Christian Göttsche 2021-02-09 15:57:22 +01:00
parent 7ba3396a4c
commit f273bfd083
1 changed files with 2 additions and 2 deletions

View File

@ -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;