Linux: consider the ZFS ARC to be cache.

This commit is based on a patch originally by @edef1c. The ZFS ARC is a cache
(it's in the name), which will be evicted by the kernel if memory pressure so
requires. Hence, the ARC should not be counted towards a system's total used
memory, and should instead be grouped with the other caches in the system.

Signed-off-by: edef <edef@edef.eu>
This commit is contained in:
multi 2020-09-24 19:13:25 +01:00
parent f4bb50294a
commit dfa40ad0eb
1 changed files with 7 additions and 0 deletions

View File

@ -202,6 +202,8 @@ double Platform_setCPUValues(Meter* this, int cpu) {
void Platform_setMemoryValues(Meter* this) { void Platform_setMemoryValues(Meter* this) {
ProcessList* pl = (ProcessList*) this->pl; ProcessList* pl = (ProcessList*) this->pl;
LinuxProcessList* lpl = (LinuxProcessList*) this->pl;
long int usedMem = pl->usedMem; long int usedMem = pl->usedMem;
long int buffersMem = pl->buffersMem; long int buffersMem = pl->buffersMem;
long int cachedMem = pl->cachedMem; long int cachedMem = pl->cachedMem;
@ -210,6 +212,11 @@ void Platform_setMemoryValues(Meter* this) {
this->values[0] = usedMem; this->values[0] = usedMem;
this->values[1] = buffersMem; this->values[1] = buffersMem;
this->values[2] = cachedMem; this->values[2] = cachedMem;
if (lpl->zfs.enabled != 0) {
this->values[0] -= lpl->zfs.size;
this->values[2] += lpl->zfs.size;
}
} }
void Platform_setSwapValues(Meter* this) { void Platform_setSwapValues(Meter* this) {