From 491c6f1044630a4134393ef91df8bcf387ae5268 Mon Sep 17 00:00:00 2001 From: ilyam8 Date: Sun, 8 May 2022 18:08:49 +0300 Subject: consider only shrinkable ZFS ARC as cache on Linux --- linux/Platform.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index d9c23394..38b66e83 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -358,8 +358,13 @@ void Platform_setMemoryValues(Meter* this) { this->values[4] = pl->availableMem; if (lpl->zfs.enabled != 0 && !Running_containerized) { - this->values[0] -= lpl->zfs.size; - this->values[3] += lpl->zfs.size; + // ZFS does not shrink below the value of zfs_arc_min. + unsigned long long int shrinkableSize = 0; + if (lpl->zfs.size > lpl->zfs.min) + shrinkableSize = lpl->zfs.size - lpl->zfs.min; + this->values[0] -= shrinkableSize; + this->values[3] += shrinkableSize; + this->values[4] += shrinkableSize; } } -- cgit v1.2.3