[lxc-devel] [lxcfs/master] fixed a problem with server stability degradation caused by cgroup dy…
yinhongbo on Github
lxc-bot at linuxcontainers.org
Wed Oct 9 03:25:41 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1965 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191008/1fc25255/attachment.bin>
-------------- next part --------------
From 5e0117a1c8eee3b0a844d7065de44daaaa81c4c0 Mon Sep 17 00:00:00 2001
From: Hongbo Yin <yinhongbo at bytedance.com>
Date: Wed, 9 Oct 2019 11:11:12 +0800
Subject: [PATCH] fixed a problem with server stability degradation caused by
cgroup dying traversal.
Signed-off-by: Hongbo Yin <yinhongbo at bytedance.com>
---
bindings.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bindings.c b/bindings.c
index 1811955..9a5a3df 100644
--- a/bindings.c
+++ b/bindings.c
@@ -3452,6 +3452,18 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
pid_t initpid = lookup_initpid_in_store(fc->pid);
if (initpid <= 0)
initpid = fc->pid;
+
+ /*
+ * fixed a problem with server stability degradation caused by cgroup dying traversal. This is a very bad problem.
+ * when initpid == 1, getting meminfo will traverses all the memory cgroup.
+ * a certain probability causes server stability to drop, such as network jitter.
+ *
+ * more questions about cgroup dying.
+ * Can refer to https://lwn.net/Articles/787614/?spm=a2c4e.10696291.0.0.105919a4uX5P3F
+ */
+ if (initpid == 1)
+ return read_file("/proc/meminfo", buf, size, d);
+
cg = get_pid_cgroup(initpid, "memory");
if (!cg)
return read_file("/proc/meminfo", buf, size, d);
More information about the lxc-devel
mailing list