From 89bd000fc7cae30da91f74319ad01846f1a89e87 Mon Sep 17 00:00:00 2001 From: Li Feng Date: Thu, 28 Jan 2021 16:19:36 +0800 Subject: [PATCH] metrics: add total_inactive_file metric for memory Signed-off-by: Li Feng --- ...otal_inactive_file-metric-for-memory.patch | 39 +++++++++++++++++++ lxc.spec | 9 ++++- series.conf | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0019-metrics-add-total_inactive_file-metric-for-memory.patch diff --git a/0019-metrics-add-total_inactive_file-metric-for-memory.patch b/0019-metrics-add-total_inactive_file-metric-for-memory.patch new file mode 100644 index 0000000..737afcc --- /dev/null +++ b/0019-metrics-add-total_inactive_file-metric-for-memory.patch @@ -0,0 +1,39 @@ +From 15da6e1f057c70eee476730138788fd73de1b208 Mon Sep 17 00:00:00 2001 +From: Li Feng +Date: Thu, 28 Jan 2021 16:05:18 +0800 +Subject: [PATCH 19/19] metrics: add total_inactive_file metric for memory + +Signed-off-by: Li Feng +--- + src/lxc/lxccontainer.c | 1 + + src/lxc/lxccontainer.h | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c +index 9202b73ff..06552ce5c 100644 +--- a/src/lxc/lxccontainer.c ++++ b/src/lxc/lxccontainer.c +@@ -5919,6 +5919,7 @@ static bool do_lxcapi_get_container_metrics(struct lxc_container *c, struct lxc + + metrics->cache = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1); + metrics->cache_total = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_cache", 1); ++ metrics->inactive_file_total = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1); + + return true; + } +diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h +index e30bf6161..9abbd09ed 100644 +--- a/src/lxc/lxccontainer.h ++++ b/src/lxc/lxccontainer.h +@@ -69,6 +69,8 @@ struct lxc_container_metrics { + /* Cache usage */ + uint64_t cache; + uint64_t cache_total; ++ /* total inactive file */ ++ uint64_t inactive_file_total; + }; + + /*! +-- +2.25.1 + diff --git a/lxc.spec b/lxc.spec index 52e1867..45a55a7 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 2021012001 +%global _release 2021012801 Name: lxc Version: 4.0.3 @@ -26,6 +26,7 @@ Patch0015: 0015-Streaming-IO-solution-optimization-and-enhancement.patch Patch0016: 0016-avoid-using-void-pointers-in-caclulation.patch Patch0017: 0017-fix-compilation-errors-without-libcap.patch Patch0018: 0018-IO-fix-io-data-miss-when-exec-with-pipes.patch +Patch0019: 0019-metrics-add-total_inactive_file-metric-for-memory.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -197,6 +198,12 @@ make check %{_mandir}/*/man7/%{name}* %changelog +* Thu Jan 28 2021 lifeng - 4.0.3-2021012801 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: add inactive file total metrics + * Wed Jan 21 2021 lifeng - 4.0.3-2021012001 - Type:enhancement - ID:NA diff --git a/series.conf b/series.conf index fcd7814..065ae00 100644 --- a/series.conf +++ b/series.conf @@ -16,3 +16,4 @@ 0016-avoid-using-void-pointers-in-caclulation.patch 0017-fix-compilation-errors-without-libcap.patch 0018-IO-fix-io-data-miss-when-exec-with-pipes.patch +0019-metrics-add-total_inactive_file-metric-for-memory.patch -- Gitee