public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common] fix #3527: cgroup: drop file buffers from memory usage
@ 2021-07-14  7:42 Wolfgang Bumiller
  2021-07-14 10:24 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Bumiller @ 2021-07-14  7:42 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH common] fix #3527: cgroup: drop file buffers from memory usage
  2021-07-14  7:42 [pve-devel] [PATCH common] fix #3527: cgroup: drop file buffers from memory usage Wolfgang Bumiller
@ 2021-07-14 10:24 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-14 10:24 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

On 14.07.21 09:42, Wolfgang Bumiller wrote:
> 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(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-14 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14  7:42 [pve-devel] [PATCH common] fix #3527: cgroup: drop file buffers from memory usage Wolfgang Bumiller
2021-07-14 10:24 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal