[lxc-devel] [lxcfs/master] meminfo: fix used/cache memory calculation under cgroup2

irnes on Github lxc-bot at linuxcontainers.org
Tue Mar 3 10:34:08 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 362 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200303/22d76c1e/attachment.bin>
-------------- next part --------------
From 91d63a9e1a1ce55a69ad8af78071ca8f0a67738a Mon Sep 17 00:00:00 2001
From: Irnes Mujkanovic <irnes at bicomsystems.com>
Date: Tue, 3 Mar 2020 10:44:42 +0100
Subject: [PATCH] meminfo: fix used/cache memory calculation under cgroup2

Signed-off-by: Irnes Mujkanovic <irnes.mujkanovic at gmail.com>
---
 proc_fuse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proc_fuse.c b/proc_fuse.c
index afe11a2..1cbf54d 100644
--- a/proc_fuse.c
+++ b/proc_fuse.c
@@ -984,8 +984,8 @@ static bool cgroup_parse_memory_stat(const char *cgroup, struct memory_stat *mst
 			sscanf(line, "hierarchical_memory_limit %" PRIu64, &(mstat->hierarchical_memory_limit));
 		} else if (!unified && startswith(line, "hierarchical_memsw_limit")) {
 			sscanf(line, "hierarchical_memsw_limit %" PRIu64, &(mstat->hierarchical_memsw_limit));
-		} else if (!unified && startswith(line, "total_cache")) {
-			sscanf(line, "total_cache %" PRIu64, &(mstat->total_cache));
+		} else if (startswith(line, unified ? "file" :"total_cache")) {
+			sscanf(line, unified ? "file %" PRIu64 : "total_cache %" PRIu64, &(mstat->total_cache));
 		} else if (!unified && startswith(line, "total_rss")) {
 			sscanf(line, "total_rss %" PRIu64, &(mstat->total_rss));
 		} else if (!unified && startswith(line, "total_rss_huge")) {


More information about the lxc-devel mailing list