[pve-devel] [PATCH qemu-server v4 3/4] vmstatus: switch mem stat to PSS of VM cgroup

Aaron Lauterer a.lauterer at proxmox.com
Sat Jul 26 03:06:23 CEST 2025


Instead of RSS, let's use the same PSS values as for the specific host
view as default, in case this value is not overwritten by the balloon
info.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

Notes:
    changes since:
    v2:
    * follow reorder of memhost collection, before cpu collection that might
      be trigger the next iteration of the loop in some situations

 src/PVE/QemuServer.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 66cb9fd4..cdeaafa0 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2678,10 +2678,6 @@ sub vmstatus {
 
         $d->{uptime} = int(($uptime - $pstat->{starttime}) / $cpuinfo->{user_hz});
 
-        if ($pstat->{vsize}) {
-            $d->{mem} = int(($pstat->{rss} / $pstat->{vsize}) * $d->{maxmem});
-        }
-
         my $fh = IO::File->new("/sys/fs/cgroup/qemu.slice/${vmid}.scope/cgroup.procs", "r");
         if ($fh) {
             while (my $childPid = <$fh>) {
@@ -2700,6 +2696,8 @@ sub vmstatus {
         }
         close($fh);
 
+        $d->{mem} = $d->{memhost};
+
         my $pressures = PVE::ProcFSTools::read_cgroup_pressure("qemu.slice/${vmid}.scope");
         $d->{pressurecpusome} = $pressures->{cpu}->{some}->{avg10} * 1;
         $d->{pressurecpufull} = $pressures->{cpu}->{full}->{avg10} * 1;
-- 
2.39.5





More information about the pve-devel mailing list