[pve-devel] [PATCH v2 common 1/1] fix #1454: meminfo: also return arcsize

Matthias Heiserer m.heiserer at proxmox.com
Tue Mar 28 14:49:26 CEST 2023


Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
Changes from v1:
None

 src/PVE/ProcFSTools.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index eb4b0f5..0686c34 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -283,6 +283,7 @@ sub read_meminfo {
 	swaptotal => 0,
 	swapfree => 0,
 	swapused => 0,
+	arcsize => 0,
     };
 
     my $fh = IO::File->new ("/proc/meminfo", "r");
@@ -307,6 +308,11 @@ sub read_meminfo {
     my $spages = PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing") // 0 ;
     $res->{memshared} = int($spages) * 4096;
 
+    my $arcstats = PVE::Tools::file_get_contents("/proc/spl/kstat/zfs/arcstats");
+    if ($arcstats && $arcstats =~ m/size\s+\d+\s+(\d+)/m) {
+	$res->{arcsize} = int ($1);
+    }
+
     return $res;
 }
 
-- 
2.30.2






More information about the pve-devel mailing list