[pve-devel] [PATCH common 4/4] metrics: add buffer and cache to meminfo

Aaron Lauterer a.lauterer at proxmox.com
Fri May 23 18:37:38 CEST 2025


From: Folke Gleumes <f.gleumes at proxmox.com>

Expose buffers and cache as separate metrics instead of including them
in memfree and memused.

Originally-by: Folke Gleumes <f.gleumes at proxmox.com>
[AL: rebased and adapted to changes that happened in the meantime]
Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 src/PVE/ProcFSTools.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 185b2b3..91a69be 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -303,6 +303,8 @@ sub read_meminfo {
 	memfree => 0,
 	memavailable => 0,
 	memused => 0,
+	membuffers => 0,
+	memcached => 0,
 	memshared => 0,
 	swaptotal => 0,
 	swapfree => 0,
@@ -328,6 +330,8 @@ sub read_meminfo {
     # available for a new workload, without pushing the system into swap, no amount of calculating
     # with BUFFER, CACHE, .. will get you there, only the kernel can know this.
     $res->{memused} = $res->{memtotal} - $d->{memavailable};
+    $res->{membuffers} = $d->{buffers};
+    $res->{memcached} = $d->{cached};
 
     $res->{swaptotal} = $d->{swaptotal};
     $res->{swapfree} = $d->{swapfree};
-- 
2.39.5





More information about the pve-devel mailing list