5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-01-08 01:17:37 +03:00

fix #3527: cgroup: drop file buffers from memory usage

matches the behavior of lxcfs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-07-14 09:42:15 +02:00 committed by Thomas Lamprecht
parent 228ab4b408
commit 61f1cb1a92

View 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: