From 81aee5bd53a3aba22ce761f2f6e4d824e9917192 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 7 Apr 2025 21:14:11 +0200 Subject: [PATCH] procfs: also return MemAvailable when parsing meminfo To promote using this over the rather useless, or well very different, MemFree. Signed-off-by: Thomas Lamprecht --- src/PVE/ProcFSTools.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm index fa6dd4f..bdddde9 100644 --- a/src/PVE/ProcFSTools.pm +++ b/src/PVE/ProcFSTools.pm @@ -279,6 +279,7 @@ sub read_meminfo { my $res = { memtotal => 0, memfree => 0, + memavailable => 0, memused => 0, memshared => 0, swaptotal => 0, @@ -300,6 +301,7 @@ sub read_meminfo { $res->{memtotal} = $d->{memtotal}; $res->{memfree} = $d->{memfree}; + $res->{memavailable} = $d->{memavailable}; # NOTE: MemAvailable is the only metric that will actually represent how much memory is # 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.