From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] fix #3527: cgroup: drop file buffers from memory usage
Date: Wed, 14 Jul 2021 09:42:15 +0200 [thread overview]
Message-ID: <20210714074215.45274-1-w.bumiller@proxmox.com> (raw)
matches the behavior of lxcfs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
src/PVE/CGroup.pm | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/PVE/CGroup.pm b/src/PVE/CGroup.pm
index f82cbb9..21681b8 100644
--- a/src/PVE/CGroup.pm
+++ b/src/PVE/CGroup.pm
@@ -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:
--
2.30.2
next reply other threads:[~2021-07-14 7:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 7:42 Wolfgang Bumiller [this message]
2021-07-14 10:24 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210714074215.45274-1-w.bumiller@proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox