]> git.proxmox.com Git - pve-common.git/commitdiff
fix #3527: cgroup: drop file buffers from memory usage
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 14 Jul 2021 07:42:15 +0000 (09:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Jul 2021 09:45:21 +0000 (11:45 +0200)
matches the behavior of lxcfs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/CGroup.pm

index f82cbb97c7cee9217c6b607f1b5e65726fc58051..21681b88a8626bc785f885ae8499362ce5518c46 100644 (file)
@@ -341,13 +341,11 @@ sub get_memory_stat {
     } elsif ($ver == 2) {
        my $mem = file_get_contents("$path/memory.current");
        my $swap = file_get_contents("$path/memory.swap.current");
+       my $stat = parse_flat_keyed_file(file_get_contents("$path/memory.stat"));
 
        chomp ($mem, $swap);
 
-       # FIXME: For the cgv1 equivalent of `total_cache` we may need to sum up
-       # the values in `memory.stat`...
-
-       $res->{mem} = $mem;
+       $res->{mem} = $mem - $stat->{file};
        $res->{swap} = $swap;
     } elsif ($ver == 1) {
        # cgroupv1 environment: