Skip to contentSkip to conversation

memcontrol04 and s/cgroup/cg/

PATCH Superseded Richard Palethorpe via ltp 4 participants 19 messages Feb 8, 2022 – Feb 17, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover memcontrol04 and s/cgroup/cg/

Hello,

This adds another test from kselftest and tries to improve the readability of the cgroup API.

This is probably the last test I will copy for now. However I may rewrite the tests to clone child processes into a CGroup when the feature is available.

Richard Palethorpe (3):
API/cgroup: Add memory.{events, low} API/cgroup: Shorten cgroup to cg in most symbols
memcontrol04: Copy from kselftest

 doc/c-test-api.txt                            |  52 ++--
 include/tst_cgroup.h                          | 112 ++++-----
 include/tst_test.h                            |   2 +-
 lib/newlib_tests/tst_cgroup01.c               |  18 +-
 lib/newlib_tests/tst_cgroup02.c               |  54 ++---
 lib/tst_cgroup.c                              | 112 ++++-----
 lib/tst_test.c                                |   8 +-
 runtest/controllers                           |   1 +
 scripts/coccinelle/cgroup-ver.cocci           |  16 +-
 .../coccinelle/kselftest-cgroup-to-ltp.cocci  |  16 +-
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol01.c   |  36 +--
 .../kernel/controllers/memcg/memcontrol02.c   |  28 +--
 .../kernel/controllers/memcg/memcontrol03.c   |  60 ++---
 .../kernel/controllers/memcg/memcontrol04.c   | 228 ++++++++++++++++++
 testcases/kernel/mem/cpuset/cpuset01.c        |  14 +-
 testcases/kernel/mem/include/mem.h            |   2 +-
 testcases/kernel/mem/ksm/ksm02.c              |   6 +-
 testcases/kernel/mem/ksm/ksm03.c              |   4 +-
 testcases/kernel/mem/ksm/ksm04.c              |   6 +-
 testcases/kernel/mem/lib/mem.c                |   8 +-
 testcases/kernel/mem/oom/oom03.c              |  18 +-
 testcases/kernel/mem/oom/oom04.c              |   8 +-
 testcases/kernel/mem/oom/oom05.c              |  24 +-
 .../sched/cfs-scheduler/cfs_bandwidth01.c     |  40 +--
 testcases/kernel/syscalls/madvise/madvise06.c |  16 +-
 26 files changed, 561 insertions(+), 329 deletions(-)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol04.c
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/3 API/cgroup: Add memory.{events, low}

---
 lib/tst_cgroup.c | 2 ++
 1 file changed, 2 insertions(+)
lib/tst_cgroup.c +2 -0
index 93d374c56..4d326c730 100644
@@ -159,6 +159,8 @@ static const struct cgroup_file cgroup_ctrl_files[] = {
 
 static const struct cgroup_file memory_ctrl_files[] = {
 	{ "memory.current", "memory.usage_in_bytes", CTRL_MEMORY },
+	{ "memory.events", NULL, CTRL_MEMORY },
+	{ "memory.low", NULL, CTRL_MEMORY },
 	{ "memory.min", NULL, CTRL_MEMORY },
 	{ "memory.max", "memory.limit_in_bytes", CTRL_MEMORY },
 	{ "memory.stat", "memory.stat", CTRL_MEMORY },
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

PATCH 2/3 API/cgroup: Shorten cgroup to cg in most symbols

In reply to Richard Palethorpe via ltp

With the current naming it is common to have 'group' repeated 3 or even 4 times in one line. This causes a number of readability problems. Renaming it to cg reduces the amount of repetition.

The one place it is not renamed is in tst_test because it won't cause repetition there. Meanwhile it is easier to search the internet for 'linux cgroup' than 'linux cg'.

Li Wang suggested renaming tst_cg to tst_cg_test because it is consistent with tst_cg_drain. However I think tst_cg is used so often that it is more important to have shorter lines.

---
 doc/c-test-api.txt                            |  52 ++++----
 include/tst_cgroup.h                          | 112 +++++++++---------
 include/tst_test.h                            |   2 +-
 lib/newlib_tests/tst_cgroup01.c               |  18 +--
 lib/newlib_tests/tst_cgroup02.c               |  54 ++++-----
 lib/tst_cgroup.c                              | 110 ++++++++---------
 lib/tst_test.c                                |   8 +-
 scripts/coccinelle/cgroup-ver.cocci           |  16 +--
 .../coccinelle/kselftest-cgroup-to-ltp.cocci  |  16 +--
 .../kernel/controllers/memcg/memcontrol01.c   |  36 +++---
 .../kernel/controllers/memcg/memcontrol02.c   |  28 ++---
 .../kernel/controllers/memcg/memcontrol03.c   |  60 +++++-----
 testcases/kernel/mem/cpuset/cpuset01.c        |  14 +--
 testcases/kernel/mem/include/mem.h            |   2 +-
 testcases/kernel/mem/ksm/ksm02.c              |   6 +-
 testcases/kernel/mem/ksm/ksm03.c              |   4 +-
 testcases/kernel/mem/ksm/ksm04.c              |   6 +-
 testcases/kernel/mem/lib/mem.c                |   8 +-
 testcases/kernel/mem/oom/oom03.c              |  18 +--
 testcases/kernel/mem/oom/oom04.c              |   8 +-
 testcases/kernel/mem/oom/oom05.c              |  24 ++--
 .../sched/cfs-scheduler/cfs_bandwidth01.c     |  40 +++----
 testcases/kernel/syscalls/madvise/madvise06.c |  16 +--
 23 files changed, 329 insertions(+), 329 deletions(-)
doc/c-test-api.txt +26 -26
index 51dac58ae..4ae49925c 100644
@@ -2084,10 +2084,10 @@ static void run(void)
 
 static void setup(void)
 {
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%lu", MEMSIZE);
-	if (SAFE_CGROUP_HAS(tst_cgroup, "memory.swap.max"))
-		SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%zu", memsw);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%lu", MEMSIZE);
+	if (SAFE_CG_HAS(tst_cg, "memory.swap.max"))
+		SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%zu", memsw);
 }
 
 struct tst_test test = {
@@ -2101,7 +2101,7 @@ struct tst_test test = {
 
 Above, we first ensure the memory controller is available on the
 test's CGroup with '.needs_cgroup_controllers'. This populates a structure,
-'tst_cgroup', which represents the test's CGroup.
+'tst_cg', which represents the test's CGroup.
 
 We then write the current processes PID into 'cgroup.procs', which
 moves the current process into the test's CGroup. After which we set
@@ -2112,7 +2112,7 @@ on both CGroup versions, then we use the V2 naming.
 
 Some controller features, such as 'memory.swap', can be
 disabled. Therefor we need to check if they exist before accessing
-them. This can be done with 'SAFE_CGROUP_HAS' which can be called on
+them. This can be done with 'SAFE_CG_HAS' which can be called on
 any control file or feature.
 
 Most tests only require setting a few limits similar to the above. In
@@ -2121,29 +2121,29 @@ cleanup is also mostly hidden. However things can get much worse.
 
 [source,c]
 -------------------------------------------------------------------------------
-static struct tst_cgroup_group *cg_child;
+static struct tst_cg_group *cg_child;
 
 static void run(void)
 {
 	char buf[BUFSIZ];
 	size_t mem = 0;
 
-	cg_child = tst_cgroup_group_mk(tst_cgroup, "child");
-	SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
+	cg_child = tst_cg_group_mk(tst_cg, "child");
+	SAFE_CG_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
 
-	if (!TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-		SAFE_CGROUP_PRINT(tst_cgroup, "cgroup.subtree_control", "+memory");
-	if (!TST_CGROUP_VER_IS_V1(tst_cgroup, "cpuset"))
-		SAFE_CGROUP_PRINT(tst_cgroup, "cgroup.subtree_control", "+cpuset");
+	if (!TST_CG_VER_IS_V1(tst_cg, "memory"))
+		SAFE_CG_PRINT(tst_cg, "cgroup.subtree_control", "+memory");
+	if (!TST_CG_VER_IS_V1(tst_cg, "cpuset"))
+		SAFE_CG_PRINT(tst_cg, "cgroup.subtree_control", "+cpuset");
 
 	if (!SAFE_FORK()) {
-		SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
+		SAFE_CG_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
 
-		if (SAFE_CGROUP_HAS(cg_child, "memory.swap")) {
-			SAFE_CGROUP_SCANF(cg_child,
+		if (SAFE_CG_HAS(cg_child, "memory.swap")) {
+			SAFE_CG_SCANF(cg_child,
 					  "memory.swap.current", "%zu", &mem);
 		}
-		SAFE_CGROUP_READ(cg_child, "cpuset.mems", buf, sizeof(buf));
+		SAFE_CG_READ(cg_child, "cpuset.mems", buf, sizeof(buf));
 
 		// Do something with cpuset.mems and memory.current values
 		...
@@ -2152,15 +2152,15 @@ static void run(void)
 	}
 
 	tst_reap_children();
-	SAFE_CGROUP_PRINTF(tst_cgroup_drain, "cgroup.procs", "%d", getpid());
-	cg_child = tst_cgroup_group_rm(cg_child);
+	SAFE_CG_PRINTF(tst_cg_drain, "cgroup.procs", "%d", getpid());
+	cg_child = tst_cg_group_rm(cg_child);
 }
 
 static void cleanup(void)
 {
 	if (cg_child) {
-		SAFE_CGROUP_PRINTF(tst_cgroup_drain, "cgroup.procs", "%d", getpid());
-		cg_child = tst_cgroup_group_rm(cg_child);
+		SAFE_CG_PRINTF(tst_cg_drain, "cgroup.procs", "%d", getpid());
+		cg_child = tst_cg_group_rm(cg_child);
 	}
 }
 
@@ -2183,12 +2183,12 @@ and these should not be changed by the test. It can be used to remove
 processes from other CGroups incase the hierarchy root is not
 accessible.
 
-Note that 'tst_cgroup_get_drain_group' should not be called many times,
+Note that 'tst_cg_get_drain_group' should not be called many times,
 as it is allocated in a guarded buffer (See section 2.2.31). Therefor
 it is best to call it once in 'setup' and not 'run' because 'run' may
 be repeated with the '-i' option.
 
-In 'run', we first create a child CGroup with 'tst_cgroup_mk'. As we
+In 'run', we first create a child CGroup with 'tst_cg_mk'. As we
 create this CGroup in 'run' we should also remove it at the end of
 run. We also need to check if it exists and remove it in cleanup as
 well. Because there are 'SAFE_' functions which may jump to cleanup.
@@ -2223,10 +2223,10 @@ Another example of a behavioral difference between versions is shown below.
 
 [source,c]
 -------------------------------------------------------------------------------
-	if (TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-		SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", ~0UL);
+	if (TST_CG_VER_IS_V1(tst_cg, "memory"))
+		SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", ~0UL);
 	else
-		SAFE_CGROUP_PRINT(tst_cgroup, "memory.swap.max", "max");
+		SAFE_CG_PRINT(tst_cg, "memory.swap.max", "max");
 -------------------------------------------------------------------------------
 
 CGroups V2 introduced a feature where 'memory[.swap].max' could be set to
include/tst_cgroup.h +56 -56

190 lines not on this page · raw message

include/tst_test.h +1 -1
index a7aaedcff..6ccd82b48 100644
@@ -283,7 +283,7 @@ struct tst_test {
 	const char *const *needs_cmds;
 
 	/* Requires a particular CGroup API version. */
-	const enum tst_cgroup_ver needs_cgroup_ver;
+	const enum tst_cg_ver needs_cgroup_ver;
 
 	/* {} terminated array of required CGroup controllers */
 	const char *const *needs_cgroup_ctrls;
lib/newlib_tests/tst_cgroup01.c +9 -9
index 0fdc57e2e..eda0c548d 100644
@@ -12,7 +12,7 @@ static struct tst_option opts[] = {
 	{"n", &no_cleanup, "-n\tLeave CGroups created by test"},
 	{NULL, NULL, NULL},
 };
-struct tst_cgroup_opts cgopts;
+struct tst_cg_opts cgopts;
 
 static void do_test(void)
 {
@@ -21,15 +21,15 @@ static void do_test(void)
 
 static void setup(void)
 {
-	cgopts.needs_ver = !!only_mount_v1 ? TST_CGROUP_V1 : 0;
+	cgopts.needs_ver = !!only_mount_v1 ? TST_CG_V1 : 0;
 
-	tst_cgroup_scan();
-	tst_cgroup_print_config();
+	tst_cg_scan();
+	tst_cg_print_config();
 
-	tst_cgroup_require("memory", &cgopts);
-	tst_cgroup_print_config();
-	tst_cgroup_require("cpuset", &cgopts);
-	tst_cgroup_print_config();
+	tst_cg_require("memory", &cgopts);
+	tst_cg_print_config();
+	tst_cg_require("cpuset", &cgopts);
+	tst_cg_print_config();
 }
 
 static void cleanup(void)
@@ -38,7 +38,7 @@ static void cleanup(void)
 		tst_res(TINFO, "no cleanup");
 	} else {
 		tst_res(TINFO, "cleanup");
-		tst_cgroup_cleanup();
+		tst_cg_cleanup();
 	}
 }
 
lib/newlib_tests/tst_cgroup02.c +27 -27

96 lines not on this page · raw message

lib/tst_cgroup.c +55 -55

337 lines not on this page · raw message

lib/tst_test.c +4 -4
index 1fd238cf5..9d96e8a39 100644
@@ -1015,15 +1015,15 @@ static void prepare_device(void)
 
 static void do_cgroup_requires(void)
 {
-	const struct tst_cgroup_opts cg_opts = {
+	const struct tst_cg_opts cg_opts = {
 		.needs_ver = tst_test->needs_cgroup_ver,
 	};
 	const char *const *ctrl_names = tst_test->needs_cgroup_ctrls;
 
 	for (; *ctrl_names; ctrl_names++)
-		tst_cgroup_require(*ctrl_names, &cg_opts);
+		tst_cg_require(*ctrl_names, &cg_opts);
 
-	tst_cgroup_init();
+	tst_cg_init();
 }
 
 static void do_setup(int argc, char *argv[])
@@ -1217,7 +1217,7 @@ static void do_test_setup(void)
 static void do_cleanup(void)
 {
 	if (tst_test->needs_cgroup_ctrls)
-		tst_cgroup_cleanup();
+		tst_cg_cleanup();
 
 	if (ovl_mounted)
 		SAFE_UMOUNT(OVL_MNT);
scripts/coccinelle/cgroup-ver.cocci +8 -8
index fc1d2ec93..0a73e94ea 100644
@@ -4,26 +4,26 @@ virtual fix
 expression cg, ctrl;
 @@
 
-- TST_CGROUP_VER(cg, ctrl) == TST_CGROUP_V1
-+ TST_CGROUP_VER_IS_V1(cg, ctrl)
+- TST_CG_VER(cg, ctrl) == TST_CG_V1
++ TST_CG_VER_IS_V1(cg, ctrl)
 
 @@
 expression cg, ctrl;
 @@
 
-- TST_CGROUP_VER(cg, ctrl) != TST_CGROUP_V1
-+ !TST_CGROUP_VER_IS_V1(cg, ctrl)
+- TST_CG_VER(cg, ctrl) != TST_CG_V1
++ !TST_CG_VER_IS_V1(cg, ctrl)
 
 @@
 expression cg, ctrl;
 @@
 
-- TST_CGROUP_VER(cg, ctrl) == TST_CGROUP_V2
-+ !TST_CGROUP_VER_IS_V1(cg, ctrl)
+- TST_CG_VER(cg, ctrl) == TST_CG_V2
++ !TST_CG_VER_IS_V1(cg, ctrl)
 
 @@
 expression cg, ctrl;
 @@
 
-- TST_CGROUP_VER(cg, ctrl) != TST_CGROUP_V2
-+ TST_CGROUP_VER_IS_V1(cg, ctrl)
+- TST_CG_VER(cg, ctrl) != TST_CG_V2
++ TST_CG_VER_IS_V1(cg, ctrl)
scripts/coccinelle/kselftest-cgroup-to-ltp.cocci +8 -8
index f91c2c467..de064af39 100644
@@ -3,7 +3,7 @@ expression cgn, cgns;
 @@
 
 - cgn = cg_name(..., cgns);
-+ cgn = tst_cgroup_group_mk(cg_test, cgns);
++ cgn = tst_cg_group_mk(cg_test, cgns);
 
 @@
 expression cg, fname, data;
@@ -12,24 +12,24 @@ expression cg, fname, data;
 - if (cg_write(cg, fname, data)) {
 -    ...
 - }
-+ SAFE_CGROUP_PRINT(cg, fname, data);
++ SAFE_CG_PRINT(cg, fname, data);
 
 @@
 expression cg;
 @@
 
-... when != TST_CGROUP_VER(...)
+... when != TST_CG_VER(...)
 
-- SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+memory");
-+ if (TST_CGROUP_VER(cg, "memory") != TST_CGROUP_V1)
-+    SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+memory");
+- SAFE_CG_PRINT(cg, "cgroup.subtree_control", "+memory");
++ if (TST_CG_VER(cg, "memory") != TST_CG_V1)
++    SAFE_CG_PRINT(cg, "cgroup.subtree_control", "+memory");
 
 @@
 expression cg, fname, needle;
 @@
 
 - cg_read_strstr(cg, fname, needle)
-+ !SAFE_CGROUP_OCCURSIN(cg, fname, needle)
++ !SAFE_CG_OCCURSIN(cg, fname, needle)
 
 @@
 identifier l;
@@ -37,4 +37,4 @@ expression cg, fname;
 @@
 
 - l = cg_read_long(cg, fname);
-+ SAFE_CGROUP_SCANF(cg, fname, "%ld", &l);
++ SAFE_CG_SCANF(cg, fname, "%ld", &l);
testcases/kernel/controllers/memcg/memcontrol01.c +18 -18
index 595192437..935b97778 100644
@@ -17,46 +17,46 @@
 
 #include "tst_test.h"
 
-static struct tst_cgroup_group *parent, *child;
-static struct tst_cgroup_group *parent2, *child2;
+static struct tst_cg_group *parent, *child;
+static struct tst_cg_group *parent2, *child2;
 
 static void test_memcg_subtree_control(void)
 {
-	parent = tst_cgroup_group_mk(tst_cgroup, "memcg_test_0");
-	child = tst_cgroup_group_mk(parent, "memcg_test_1");
-	parent2 = tst_cgroup_group_mk(tst_cgroup, "memcg_test_2");
-	child2 = tst_cgroup_group_mk(parent2, "memcg_test_3");
+	parent = tst_cg_group_mk(tst_cg, "memcg_test_0");
+	child = tst_cg_group_mk(parent, "memcg_test_1");
+	parent2 = tst_cg_group_mk(tst_cg, "memcg_test_2");
+	child2 = tst_cg_group_mk(parent2, "memcg_test_3");
 
-	SAFE_CGROUP_PRINT(parent2, "cgroup.subtree_control", "-memory");
+	SAFE_CG_PRINT(parent2, "cgroup.subtree_control", "-memory");
 
 	TST_EXP_POSITIVE(
-		SAFE_CGROUP_OCCURSIN(child, "cgroup.controllers", "memory"),
+		SAFE_CG_OCCURSIN(child, "cgroup.controllers", "memory"),
 		"child should have memory controller");
 	TST_EXP_POSITIVE(
-		!SAFE_CGROUP_OCCURSIN(child2, "cgroup.controllers", "memory"),
+		!SAFE_CG_OCCURSIN(child2, "cgroup.controllers", "memory"),
 		"child2 should not have memory controller");
 
-	child2 = tst_cgroup_group_rm(child2);
-	parent2 = tst_cgroup_group_rm(parent2);
-	child = tst_cgroup_group_rm(child);
-	parent = tst_cgroup_group_rm(parent);
+	child2 = tst_cg_group_rm(child2);
+	parent2 = tst_cg_group_rm(parent2);
+	child = tst_cg_group_rm(child);
+	parent = tst_cg_group_rm(parent);
 }
 
 static void cleanup(void)
 {
 	if (child2)
-		child2 = tst_cgroup_group_rm(child2);
+		child2 = tst_cg_group_rm(child2);
 	if (parent2)
-		parent2 = tst_cgroup_group_rm(parent2);
+		parent2 = tst_cg_group_rm(parent2);
 	if (child)
-		child = tst_cgroup_group_rm(child);
+		child = tst_cg_group_rm(child);
 	if (parent)
-		parent = tst_cgroup_group_rm(parent);
+		parent = tst_cg_group_rm(parent);
 }
 
 static struct tst_test test = {
 	.cleanup = cleanup,
 	.test_all = test_memcg_subtree_control,
-	.needs_cgroup_ver = TST_CGROUP_V2,
+	.needs_cgroup_ver = TST_CG_V2,
 	.needs_cgroup_ctrls = (const char *const []){ "memory", NULL },
 };
testcases/kernel/controllers/memcg/memcontrol02.c +14 -14
index 4adb31512..1656176b6 100644
@@ -26,7 +26,7 @@
 #include "memcontrol_common.h"
 
 static size_t page_size;
-static struct tst_cgroup_group *cg_child;
+static struct tst_cg_group *cg_child;
 static int fd;
 static int file_to_all_error = 10;
 
@@ -36,17 +36,17 @@ static void alloc_anon_50M_check(void)
 	char *buf, *ptr;
 	ssize_t anon, current;
 	const char *const anon_key_fmt =
-		TST_CGROUP_VER_IS_V1(tst_cgroup, "memory") ? "rss %zd" : "anon %zd";
+		TST_CG_VER_IS_V1(tst_cg, "memory") ? "rss %zd" : "anon %zd";
 
 	buf = SAFE_MALLOC(size);
 	for (ptr = buf; ptr < buf + size; ptr += page_size)
 		*ptr = 0;
 
-	SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zd", &current);
+	SAFE_CG_SCANF(cg_child, "memory.current", "%zd", &current);
 	TST_EXP_EXPR(current >= size,
 		     "(memory.current=%zd) >= (size=%zd)", current, size);
 
-	SAFE_CGROUP_LINES_SCANF(cg_child, "memory.stat", anon_key_fmt, &anon);
+	SAFE_CG_LINES_SCANF(cg_child, "memory.stat", anon_key_fmt, &anon);
 
 	TST_EXP_EXPR(anon > 0, "(memory.stat.anon=%zd) > 0", anon);
 	TST_EXP_EXPR(values_close(size, anon, 3),
@@ -61,20 +61,20 @@ static void alloc_pagecache_50M_check(void)
 	const size_t size = MB(50);
 	size_t current, file;
 	const char *const file_key_fmt =
-		TST_CGROUP_VER_IS_V1(tst_cgroup, "memory") ? "cache %zd" : "file %zd";
+		TST_CG_VER_IS_V1(tst_cg, "memory") ? "cache %zd" : "file %zd";
 
 	fd = SAFE_OPEN(TMPDIR"/tmpfile", O_RDWR | O_CREAT, 0600);
 
-	SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zu", &current);
+	SAFE_CG_SCANF(cg_child, "memory.current", "%zu", &current);
 	tst_res(TINFO, "Created temp file: memory.current=%zu", current);
 
 	alloc_pagecache(fd, size);
 
-	SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zu", &current);
+	SAFE_CG_SCANF(cg_child, "memory.current", "%zu", &current);
 	TST_EXP_EXPR(current >= size,
 			 "(memory.current=%zu) >= (size=%zu)", current, size);
 
-	SAFE_CGROUP_LINES_SCANF(cg_child, "memory.stat", file_key_fmt, &file);
+	SAFE_CG_LINES_SCANF(cg_child, "memory.stat", file_key_fmt, &file);
 	TST_EXP_EXPR(file > 0, "(memory.stat.file=%zd) > 0", file);
 
 	TST_EXP_EXPR(values_close(file, current, file_to_all_error),
@@ -88,14 +88,14 @@ static void test_memcg_current(unsigned int n)
 {
 	size_t current;
 
-	cg_child = tst_cgroup_group_mk(tst_cgroup, "child");
-	SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zu", &current);
+	cg_child = tst_cg_group_mk(tst_cg, "child");
+	SAFE_CG_SCANF(cg_child, "memory.current", "%zu", &current);
 	TST_EXP_EXPR(current == 0, "(current=%zu) == 0", current);
 
 	if (!SAFE_FORK()) {
-		SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
+		SAFE_CG_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
 
-		SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zu", &current);
+		SAFE_CG_SCANF(cg_child, "memory.current", "%zu", &current);
 		tst_res(TINFO, "Added proc to memcg: memory.current=%zu",
 			current);
 
@@ -105,7 +105,7 @@ static void test_memcg_current(unsigned int n)
 			alloc_pagecache_50M_check();
 	} else {
 		tst_reap_children();
-		cg_child = tst_cgroup_group_rm(cg_child);
+		cg_child = tst_cg_group_rm(cg_child);
 	}
 }
 
@@ -125,7 +125,7 @@ static void setup(void)
 static void cleanup(void)
 {
 	if (cg_child)
-		cg_child = tst_cgroup_group_rm(cg_child);
+		cg_child = tst_cg_group_rm(cg_child);
 }
 
 static struct tst_test test = {
testcases/kernel/controllers/memcg/memcontrol03.c +30 -30

150 lines not on this page · raw message

testcases/kernel/mem/cpuset/cpuset01.c +7 -7
index 6383187d7..6e9691edb 100644
@@ -51,10 +51,10 @@ static void test_cpuset(void)
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 	char buf[BUFSIZ];
 
-	SAFE_CGROUP_READ(tst_cgroup, "cpuset.cpus", buf, sizeof(buf));
-	SAFE_CGROUP_PRINT(tst_cgroup, "cpuset.cpus", buf);
-	SAFE_CGROUP_READ(tst_cgroup, "cpuset.mems", buf, sizeof(buf));
-	SAFE_CGROUP_PRINT(tst_cgroup, "cpuset.mems", buf);
+	SAFE_CG_READ(tst_cg, "cpuset.cpus", buf, sizeof(buf));
+	SAFE_CG_PRINT(tst_cg, "cpuset.cpus", buf);
+	SAFE_CG_READ(tst_cg, "cpuset.mems", buf, sizeof(buf));
+	SAFE_CG_PRINT(tst_cg, "cpuset.mems", buf);
 
 	child = SAFE_FORK();
 	if (child == 0) {
@@ -68,8 +68,8 @@ static void test_cpuset(void)
 		exit(mem_hog_cpuset(ncpus > 1 ? ncpus : 1));
 	}
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cpuset.mems", "%d", nodes[0]);
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cpuset.mems", "%d", nodes[1]);
+	SAFE_CG_PRINTF(tst_cg, "cpuset.mems", "%d", nodes[0]);
+	SAFE_CG_PRINTF(tst_cg, "cpuset.mems", "%d", nodes[1]);
 
 	tst_reap_children();
 
@@ -84,7 +84,7 @@ static void setup(void)
 	if (nnodes <= 1)
 		tst_brk(TCONF, "requires a NUMA system.");
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
 }
 
 static void sighandler(int signo LTP_ATTRIBUTE_UNUSED)
testcases/kernel/mem/include/mem.h +1 -1
index 47a180d7e..f1cba5fcb 100644
@@ -65,7 +65,7 @@ void check_hugepage(void);
 void write_memcg(void);
 
 /* cpuset/memcg - include/tst_cgroup.h */
-void write_cpusets(const struct tst_cgroup_group *cg, long nd);
+void write_cpusets(const struct tst_cg_group *cg, long nd);
 
 /* shared */
 unsigned int get_a_numa_node(void);
testcases/kernel/mem/ksm/ksm02.c +3 -3
index 2a890f025..76a87c6b1 100644
@@ -76,10 +76,10 @@ static void verify_ksm(void)
 	}
 	create_same_memory(size, num, unit);
 
-	write_cpusets(tst_cgroup, node);
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
+	write_cpusets(tst_cg, node);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
 	create_same_memory(size, num, unit);
-	SAFE_CGROUP_PRINTF(tst_cgroup_drain, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg_drain, "cgroup.procs", "%d", getpid());
 }
 
 static void cleanup(void)
testcases/kernel/mem/ksm/ksm03.c +2 -2
index 03fad2ee2..6a0566f43 100644
@@ -77,8 +77,8 @@ static void setup(void)
 
 	parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%lu", TESTMEM);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%lu", TESTMEM);
 }
 
 static void cleanup(void)
testcases/kernel/mem/ksm/ksm04.c +3 -3
index 683780907..77fafa641 100644
@@ -67,7 +67,7 @@ static void verify_ksm(void)
 	node = get_a_numa_node();
 	set_node(nmask, node);
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%lu", TESTMEM);
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%lu", TESTMEM);
 
 	if (set_mempolicy(MPOL_BIND, nmask, MAXNODES) == -1) {
 		if (errno != ENOSYS)
@@ -78,7 +78,7 @@ static void verify_ksm(void)
 	}
 	create_same_memory(size, num, unit);
 
-	write_cpusets(tst_cgroup, node);
+	write_cpusets(tst_cg, node);
 	create_same_memory(size, num, unit);
 }
 
@@ -102,7 +102,7 @@ static void setup(void)
 
 	parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
 }
 
 static struct tst_test test = {
testcases/kernel/mem/lib/mem.c +4 -4
index a4bede0df..99d5f7f53 100644
@@ -632,11 +632,11 @@ static void gather_node_cpus(char *cpus, long nd)
 	cpus[strlen(cpus) - 1] = '\0';
 }
 
-void write_cpusets(const struct tst_cgroup_group *cg, long nd)
+void write_cpusets(const struct tst_cg_group *cg, long nd)
 {
 	char cpus[BUFSIZ] = "";
 
-	SAFE_CGROUP_PRINTF(cg, "cpuset.mems", "%ld", nd);
+	SAFE_CG_PRINTF(cg, "cpuset.mems", "%ld", nd);
 
 	gather_node_cpus(cpus, nd);
 	/*
@@ -645,11 +645,11 @@ void write_cpusets(const struct tst_cgroup_group *cg, long nd)
 	 * the value of cpuset.cpus.
 	 */
 	if (strlen(cpus) != 0) {
-		SAFE_CGROUP_PRINT(cg, "cpuset.cpus", cpus);
+		SAFE_CG_PRINT(cg, "cpuset.cpus", cpus);
 	} else {
 		tst_res(TINFO, "No CPUs in the node%ld; "
 				"using only CPU0", nd);
-		SAFE_CGROUP_PRINT(cg, "cpuset.cpus", "0");
+		SAFE_CG_PRINT(cg, "cpuset.cpus", "0");
 	}
 }
 
testcases/kernel/mem/oom/oom03.c +9 -9
index 8b4fb47c7..48a0f20b5 100644
@@ -43,7 +43,7 @@ static void verify_oom(void)
 #endif
 	testoom(0, 0, ENOMEM, 1);
 
-	if (SAFE_CGROUP_HAS(tst_cgroup, "memory.swap.max")) {
+	if (SAFE_CG_HAS(tst_cg, "memory.swap.max")) {
 		tst_res(TINFO, "OOM on MEMCG with special memswap limitation:");
 		/*
 		 * Cgroup v2 tracks memory and swap in separate, which splits
@@ -55,17 +55,17 @@ static void verify_oom(void)
 		 * let's scale down the value of 'memory.swap.max' to only
 		 * 1MB for CGroup v2.
 		 */
-		if (!TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", MB);
+		if (!TST_CG_VER_IS_V1(tst_cg, "memory"))
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", MB);
 		else
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", TESTMEM + MB);
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", TESTMEM + MB);
 
 		testoom(0, 1, ENOMEM, 1);
 
-		if (TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", ~0UL);
+		if (TST_CG_VER_IS_V1(tst_cg, "memory"))
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", ~0UL);
 		else
-			SAFE_CGROUP_PRINT(tst_cgroup, "memory.swap.max", "max");
+			SAFE_CG_PRINT(tst_cg, "memory.swap.max", "max");
 	}
 
 	/* OOM for MEMCG with mempolicy */
@@ -82,8 +82,8 @@ static void setup(void)
 	overcommit = get_sys_tune("overcommit_memory");
 	set_sys_tune("overcommit_memory", 1, 1);
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%lu", TESTMEM);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%lu", TESTMEM);
 }
 
 static void cleanup(void)
testcases/kernel/mem/oom/oom04.c +4 -4
index 8e8902b76..6b65383a3 100644
@@ -45,13 +45,13 @@ static void verify_oom(void)
 	testoom(0, 0, ENOMEM, 1);
 
 	if (is_numa(NULL, NH_MEMS, 2) &&
-	    SAFE_CGROUP_HAS(tst_cgroup, "cpuset.memory_migrate")) {
+	    SAFE_CG_HAS(tst_cg, "cpuset.memory_migrate")) {
 		/*
 		 * Under NUMA system, the migration of cpuset's memory
 		 * is in charge of cpuset.memory_migrate, we can write
 		 * 1 to cpuset.memory_migrate to enable the migration.
 		 */
-		SAFE_CGROUP_PRINT(tst_cgroup, "cpuset.memory_migrate", "1");
+		SAFE_CG_PRINT(tst_cg, "cpuset.memory_migrate", "1");
 
 		tst_res(TINFO, "OOM on CPUSET with mem migrate:");
 		testoom(0, 0, ENOMEM, 1);
@@ -78,8 +78,8 @@ static void setup(void)
 	if (ret < 0)
 		tst_brk(TBROK, "Failed to get a memory node "
 			      "using get_allowed_nodes()");
-	write_cpusets(tst_cgroup, memnode);
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
+	write_cpusets(tst_cg, memnode);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
 }
 
 static void cleanup(void)
testcases/kernel/mem/oom/oom05.c +12 -12
index ca60f1101..91c9bec83 100644
@@ -51,29 +51,29 @@ static void verify_oom(void)
 	 * 1 to cpuset.memory_migrate to enable the migration.
 	 */
 	if (is_numa(NULL, NH_MEMS, 2) &&
-	    SAFE_CGROUP_HAS(tst_cgroup, "cpuset.memory_migrate")) {
-		SAFE_CGROUP_PRINT(tst_cgroup, "cpuset.memory_migrate", "1");
+	    SAFE_CG_HAS(tst_cg, "cpuset.memory_migrate")) {
+		SAFE_CG_PRINT(tst_cg, "cpuset.memory_migrate", "1");
 		tst_res(TINFO, "OOM on CPUSET & MEMCG with "
 				"cpuset.memory_migrate=1");
 		testoom(0, 0, ENOMEM, 1);
 	}
 
-	if (SAFE_CGROUP_HAS(tst_cgroup, "memory.swap.max")) {
+	if (SAFE_CG_HAS(tst_cg, "memory.swap.max")) {
 		tst_res(TINFO, "OOM on CPUSET & MEMCG with "
 				"special memswap limitation:");
-		if (!TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", MB);
+		if (!TST_CG_VER_IS_V1(tst_cg, "memory"))
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", MB);
 		else
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", TESTMEM + MB);
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", TESTMEM + MB);
 
 		testoom(0, 1, ENOMEM, 1);
 
 		tst_res(TINFO, "OOM on CPUSET & MEMCG with "
 				"disabled memswap limitation:");
-		if (TST_CGROUP_VER_IS_V1(tst_cgroup, "memory"))
-			SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%lu", ~0UL);
+		if (TST_CG_VER_IS_V1(tst_cg, "memory"))
+			SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%lu", ~0UL);
 		else
-			SAFE_CGROUP_PRINT(tst_cgroup, "memory.swap.max", "max");
+			SAFE_CG_PRINT(tst_cg, "memory.swap.max", "max");
 		testoom(0, 0, ENOMEM, 1);
 	}
 }
@@ -99,9 +99,9 @@ void setup(void)
 		tst_brk(TBROK, "Failed to get a memory node "
 			      "using get_allowed_nodes()");
 
-	write_cpusets(tst_cgroup, memnode);
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%lu", TESTMEM);
+	write_cpusets(tst_cg, memnode);
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%lu", TESTMEM);
 }
 
 void cleanup(void)
testcases/kernel/sched/cfs-scheduler/cfs_bandwidth01.c +20 -20
index 2c28b83a2..a24dccc4e 100644
@@ -31,37 +31,37 @@
 #include "tst_test.h"
 #include "tst_timer.h"
 
-static struct tst_cgroup_group *cg_level2, *cg_level3a, *cg_level3b;
-static struct tst_cgroup_group *cg_workers[3];
+static struct tst_cg_group *cg_level2, *cg_level3a, *cg_level3b;
+static struct tst_cg_group *cg_workers[3];
 static int may_have_waiters = 0;
 
-static void set_cpu_quota(const struct tst_cgroup_group *const cg,
+static void set_cpu_quota(const struct tst_cg_group *const cg,
 			  const float quota_percent)
 {
 	const unsigned int period_us = 10000;
 	const unsigned int quota_us = (quota_percent / 100) * (float)period_us;
 
-	if (!TST_CGROUP_VER_IS_V1(cg, "cpu")) {
-		SAFE_CGROUP_PRINTF(cg, "cpu.max",
+	if (!TST_CG_VER_IS_V1(cg, "cpu")) {
+		SAFE_CG_PRINTF(cg, "cpu.max",
 				   "%u %u", quota_us, period_us);
 	} else {
-		SAFE_CGROUP_PRINTF(cg, "cpu.cfs_period_us",
+		SAFE_CG_PRINTF(cg, "cpu.cfs_period_us",
 				  "%u", period_us);
-		SAFE_CGROUP_PRINTF(cg, "cpu.max",
+		SAFE_CG_PRINTF(cg, "cpu.max",
 				   "%u", quota_us);
 	}
 
 	tst_res(TINFO, "Set '%s/cpu.max' = '%d %d'",
-		tst_cgroup_group_name(cg), quota_us, period_us);
+		tst_cg_group_name(cg), quota_us, period_us);
 }
 
-static void mk_cpu_cgroup(struct tst_cgroup_group **cg,
-			  const struct tst_cgroup_group *const cg_parent,
+static void mk_cpu_cgroup(struct tst_cg_group **cg,
+			  const struct tst_cg_group *const cg_parent,
 			  const char *const cg_child_name,
 			  const float quota_percent)
 
 {
-	*cg = tst_cgroup_group_mk(cg_parent, "%s", cg_child_name);
+	*cg = tst_cg_group_mk(cg_parent, "%s", cg_child_name);
 
 	set_cpu_quota(*cg, quota_percent);
 }
@@ -83,7 +83,7 @@ static void busy_loop(const unsigned int sleep_ms)
 	}
 }
 
-static void fork_busy_procs_in_cgroup(const struct tst_cgroup_group *const cg)
+static void fork_busy_procs_in_cgroup(const struct tst_cg_group *const cg)
 {
 	const unsigned int sleeps_ms[] = {3000, 1000, 10};
 	const pid_t worker_pid = SAFE_FORK();
@@ -98,7 +98,7 @@ static void fork_busy_procs_in_cgroup(const struct tst_cgroup_group *const cg)
 		if (!busy_pid)
 			busy_loop(sleeps_ms[i]);
 
-		SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", busy_pid);
+		SAFE_CG_PRINTF(cg, "cgroup.procs", "%d", busy_pid);
 	}
 
 	tst_reap_children();
@@ -131,13 +131,13 @@ static void do_test(void)
 
 static void setup(void)
 {
-	cg_level2 = tst_cgroup_group_mk(tst_cgroup, "level2");
+	cg_level2 = tst_cg_group_mk(tst_cg, "level2");
 
-	cg_level3a = tst_cgroup_group_mk(cg_level2, "level3a");
+	cg_level3a = tst_cg_group_mk(cg_level2, "level3a");
 	mk_cpu_cgroup(&cg_workers[0], cg_level3a, "worker1", 30);
 	mk_cpu_cgroup(&cg_workers[1], cg_level3a, "worker2", 20);
 
-	cg_level3b = tst_cgroup_group_mk(cg_level2, "level3b");
+	cg_level3b = tst_cg_group_mk(cg_level2, "level3b");
 	mk_cpu_cgroup(&cg_workers[2], cg_level3b, "worker3", 30);
 }
 
@@ -153,15 +153,15 @@ static void cleanup(void)
 
 	for (i = 0; i < ARRAY_SIZE(cg_workers); i++) {
 		if (cg_workers[i])
-			cg_workers[i] = tst_cgroup_group_rm(cg_workers[i]);
+			cg_workers[i] = tst_cg_group_rm(cg_workers[i]);
 	}
 
 	if (cg_level3a)
-		cg_level3a = tst_cgroup_group_rm(cg_level3a);
+		cg_level3a = tst_cg_group_rm(cg_level3a);
 	if (cg_level3b)
-		cg_level3b = tst_cgroup_group_rm(cg_level3b);
+		cg_level3b = tst_cg_group_rm(cg_level3b);
 	if (cg_level2)
-		cg_level2 = tst_cgroup_group_rm(cg_level2);
+		cg_level2 = tst_cg_group_rm(cg_level2);
 }
 
 static struct tst_test test = {
testcases/kernel/syscalls/madvise/madvise06.c +8 -8
index a2f32f733..54391db28 100644
@@ -70,10 +70,10 @@ static void print_cgmem(const char *name)
 {
 	long ret;
 
-	if (!SAFE_CGROUP_HAS(tst_cgroup, name))
+	if (!SAFE_CG_HAS(tst_cg, name))
 		return;
 
-	SAFE_CGROUP_SCANF(tst_cgroup, name, "%ld", &ret);
+	SAFE_CG_SCANF(tst_cg, name, "%ld", &ret);
 	tst_res(TINFO, "\t%s: %ld Kb", name, ret / 1024);
 }
 
@@ -118,18 +118,18 @@ static void setup(void)
 	check_path("/proc/self/oom_score_adj");
 	SAFE_FILE_PRINTF("/proc/self/oom_score_adj", "%d", -1000);
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "memory.max", "%ld", MEM_LIMIT);
-	if (SAFE_CGROUP_HAS(tst_cgroup, "memory.swap.max"))
-		SAFE_CGROUP_PRINTF(tst_cgroup, "memory.swap.max", "%ld", MEMSW_LIMIT);
+	SAFE_CG_PRINTF(tst_cg, "memory.max", "%ld", MEM_LIMIT);
+	if (SAFE_CG_HAS(tst_cg, "memory.swap.max"))
+		SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%ld", MEMSW_LIMIT);
 
-	if (SAFE_CGROUP_HAS(tst_cgroup, "memory.swappiness")) {
-		SAFE_CGROUP_PRINT(tst_cgroup, "memory.swappiness", "60");
+	if (SAFE_CG_HAS(tst_cg, "memory.swappiness")) {
+		SAFE_CG_PRINT(tst_cg, "memory.swappiness", "60");
 	} else {
 		check_path("/proc/sys/vm/swappiness");
 		SAFE_FILE_PRINTF("/proc/sys/vm/swappiness", "%d", 60);
 	}
 
-	SAFE_CGROUP_PRINTF(tst_cgroup, "cgroup.procs", "%d", getpid());
+	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
 
 	meminfo_diag("Initial meminfo, later values are relative to this (except memcg)");
 	init_swap = SAFE_READ_MEMINFO("SwapTotal:") - SAFE_READ_MEMINFO("SwapFree:");
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Re: [LTP] [PATCH 2/3] API/cgroup: Shorten cgroup to cg in most symbols

Quoted 4 lines · Richard Palethorpe via ltp

With the current naming it is common to have 'group' repeated 3 or even 4 times in one line. This causes a number of readability problems. Renaming it to cg reduces the amount of repetition.

Quoted 8 lines

The one place it is not renamed is in tst_test because it won't cause repetition there. Meanwhile it is easier to search the internet for 'linux cgroup' than 'linux cg'.

Li Wang suggested renaming tst_cg to tst_cg_test because it is consistent with tst_cg_drain. However I think tst_cg is used so often that it is more important to have shorter lines.

To be honest, I only wanted that tst_cg_test pointer :).

But I have no objection to renaming 'tst_cgroup_*' to 'tst_cg_*' for the whole APIs. (Though I don't like it)

Let's hear more voices from peers.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Re: [LTP] [PATCH 2/3] API/cgroup: Shorten cgroup to cg in most symbols

Hello Li,

Quoted 10 lines · Li Wang

On Tue, Feb 8, 2022 at 10:04 PM Richard Palethorpe via ltp <[email protected]> wrote:

With the current naming it is common to have 'group' repeated 3 or even 4 times in one line. This causes a number of readability problems. Renaming it to cg reduces the amount of repetition.

The one place it is not renamed is in tst_test because it won't cause repetition there. Meanwhile it is easier to search the internet for 'linux cgroup' than 'linux cg'.

Quoted 5 lines

Li Wang suggested renaming tst_cg to tst_cg_test because it is consistent with tst_cg_drain. However I think tst_cg is used so often that it is more important to have shorter lines.

To be honest, I only wanted that tst_cg_test pointer :).

I understand, but I saw that a lot of lines had become too long with other changes. It's starting to get difficult to manage.

Quoted 5 lines

But I have no objection to renaming 'tst_cgroup_*' to 'tst_cg_*' for the whole APIs. (Though I don't like it)

Let's hear more voices from peers.

;-)

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Re: [LTP] [PATCH 2/3] API/cgroup: Shorten cgroup to cg in most symbols

In reply to Li Wang

Hi!

Quoted 6 lines

To be honest, I only wanted that tst_cg_test pointer :).

But I have no objection to renaming 'tst_cgroup_*' to 'tst_cg_*' for the whole APIs. (Though I don't like it)

Let's hear more voices from peers.

Actually I like it, having the common prefix shortened to just tst_cg_ makes it easier to read, at least for me.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH 2/3] API/cgroup: Shorten cgroup to cg in most symbols

Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 6 lines

To be honest, I only wanted that tst_cg_test pointer :).

But I have no objection to renaming 'tst_cgroup_*' to 'tst_cg_*' for the whole APIs. (Though I don't like it)

Let's hear more voices from peers.

Actually I like it, having the common prefix shortened to just tst_cg_ makes it easier to read, at least for me.

Well, two to one, thanks for the comments :).

@Richard Palethorpe <[email protected]> Hi Richard, Feel free to push 1/3 and 2/3 patches, in case someone (I guess Luke) waiting for the code rebase on it.

We can hold patch 3/3(memcontrol04) for a while for fail debugging. (I am involved in another stuff these days, will look back on that soon)

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

Re: [LTP] [PATCH 2/3] API/cgroup: Shorten cgroup to cg in most symbols

Hello Li,

Quoted 15 lines · Li Wang

On Wed, Feb 16, 2022 at 11:27 PM Cyril Hrubis <[email protected]> wrote:

Hi!

Quoted 6 lines

To be honest, I only wanted that tst_cg_test pointer :).

But I have no objection to renaming 'tst_cgroup_*' to 'tst_cg_*' for the whole APIs. (Though I don't like it)

Let's hear more voices from peers.

Actually I like it, having the common prefix shortened to just tst_cg_ makes it easier to read, at least for me.

Well, two to one, thanks for the comments :).

Quoted 7 lines

@Richard Palethorpe Hi Richard,
Feel free to push 1/3 and 2/3 patches, in case someone (I guess Luke) waiting for the code rebase on it.

We can hold patch 3/3(memcontrol04) for a while for fail debugging. (I am involved in another stuff these days, will look back on that soon)

Ah, OK, thanks, I will do that. I just sent a V2 with these in, but I had not read your's and Cyril's messages.

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

PATCH 3/3 memcontrol04: Copy from kselftest

In reply to Richard Palethorpe via ltp

At first glance this test looks the same as memcontrol03. However there are some significant changes which complicate combining the two.

---
 runtest/controllers                           |   1 +
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol04.c   | 228 ++++++++++++++++++
 3 files changed, 230 insertions(+)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol04.c
runtest/controllers +1 -0
index 4a6f919af..3108a2561 100644
@@ -20,6 +20,7 @@ memcg_control		memcg_control_test.sh
 memcontrol01 memcontrol01
 memcontrol02 memcontrol02
 memcontrol03 memcontrol03
+memcontrol04 memcontrol04
 
 cgroup_fj_function_debug cgroup_fj_function.sh debug
 cgroup_fj_function_cpuset cgroup_fj_function.sh cpuset
testcases/kernel/controllers/memcg/.gitignore +1 -0
index 49df1582c..3883cede6 100644
@@ -8,3 +8,4 @@
 memcontrol01
 memcontrol02
 memcontrol03
+memcontrol04
testcases/kernel/controllers/memcg/memcontrol04.c new file +228 -0

228 lines not on this page · raw message

Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Quoted 46 lines · Richard Palethorpe via ltp

At first glance this test looks the same as memcontrol03. However there are some significant changes which complicate combining the two.

---
 runtest/controllers                           |   1 +
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol04.c   | 228 ++++++++++++++++++
 3 files changed, 230 insertions(+)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol04.c
runtest/controllers +1 -0
index 4a6f919af..3108a2561 100644
@@ -20,6 +20,7 @@ memcg_control         memcg_control_test.sh
 memcontrol01 memcontrol01
 memcontrol02 memcontrol02
 memcontrol03 memcontrol03
+memcontrol04 memcontrol04
 
 cgroup_fj_function_debug cgroup_fj_function.sh debug
 cgroup_fj_function_cpuset cgroup_fj_function.sh cpuset
testcases/kernel/controllers/memcg/.gitignore +1 -0
index 49df1582c..3883cede6 100644
@@ -8,3 +8,4 @@
 memcontrol01
 memcontrol02
 memcontrol03
+memcontrol04
testcases/kernel/controllers/memcg/memcontrol04.c new file +5 -0
new file mode 100644
index 000000000..cdfeff4a4
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: GPL-2.0
+/*\
+ *
+ * [Description]
+ *

testcases/kernel/controllers/memcg/memcontrol04.c line 15

Quoted 10 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +10 -0
+ * Conversion of the forth kself test in cgroup/test_memcontrol.c.
+ *
+ * Original description:
+ * "First, this test creates the following hierarchy:
+ * A       memory.low = 50M,  memory.max = 200M
+ * A/B     memory.low = 50M,  memory.current = 50M
+ * A/B/C   memory.low = 75M,  memory.current = 50M
+ * A/B/D   memory.low = 25M,  memory.current = 50M
+ * A/B/E   memory.low = 500M, memory.current = 0
+ * A/B/F   memory.low = 0,    memory.current = 50M

This test has a high repetition with memcontrol03, I'm just wondering if any possibility to merge together by defining a struct tcase?

static struct tcase {
       char *ctrl_file;
} tcases[] = {
       {"memory.min"},
       {"memory.low"}
};
Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#12 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Hello Li,

Quoted 10 lines · Li Wang

This test has a high repetition with memcontrol03, I'm just wondering if any possibility to merge together by defining a struct tcase?

static struct tcase {
       char *ctrl_file;
} tcases[] = {
       {"memory.min"},
       {"memory.low"}
};

There are a number of places where the logic is different. We would end up a with a test full of branches. There is some boilerplate which is the same for now, but that could also diverge between tests.

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

In reply to Richard Palethorpe via ltp
Quoted 156 lines · Richard Palethorpe via ltp

At first glance this test looks the same as memcontrol03. However there are some significant changes which complicate combining the two.

---
 runtest/controllers                           |   1 +
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol04.c   | 228 ++++++++++++++++++
 3 files changed, 230 insertions(+)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol04.c
runtest/controllers +1 -0
index 4a6f919af..3108a2561 100644
@@ -20,6 +20,7 @@ memcg_control         memcg_control_test.sh
 memcontrol01 memcontrol01
 memcontrol02 memcontrol02
 memcontrol03 memcontrol03
+memcontrol04 memcontrol04
 
 cgroup_fj_function_debug cgroup_fj_function.sh debug
 cgroup_fj_function_cpuset cgroup_fj_function.sh cpuset
testcases/kernel/controllers/memcg/.gitignore +1 -0
index 49df1582c..3883cede6 100644
@@ -8,3 +8,4 @@
 memcontrol01
 memcontrol02
 memcontrol03
+memcontrol04
testcases/kernel/controllers/memcg/memcontrol04.c new file +115 -0
new file mode 100644
index 000000000..cdfeff4a4
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: GPL-2.0
+/*\
+ *
+ * [Description]
+ *
+ * Conversion of the forth kself test in cgroup/test_memcontrol.c.
+ *
+ * Original description:
+ * "First, this test creates the following hierarchy:
+ * A       memory.low = 50M,  memory.max = 200M
+ * A/B     memory.low = 50M,  memory.current = 50M
+ * A/B/C   memory.low = 75M,  memory.current = 50M
+ * A/B/D   memory.low = 25M,  memory.current = 50M
+ * A/B/E   memory.low = 500M, memory.current = 0
+ * A/B/F   memory.low = 0,    memory.current = 50M
+ *
+ * Usages are pagecache
+ * Then it creates A/G and creates a significant
+ * memory pressure in it.
+ *
+ * A/B    memory.current ~= 50M
+ * A/B/C  memory.current ~= 33M
+ * A/B/D  memory.current ~= 17M
+ * A/B/E  memory.current ~= 0
+ *
+ * After that it tries to allocate more than there is unprotected
+ * memory in A available, and checks that memory.low protects
+ * pagecache even in this case."
+ *
+ * The closest thing to memory.low on V1 is soft_limit_in_bytes which
+ * uses a different mechanism and has different semantics. So we only
+ * test on V2 like the selftest. We do test on more file systems, but
+ * not tempfs becaue it can't evict the page cache without swap. Also
+ * we avoid filesystems which allocate extra memory for buffer heads.
+ *
+ * The tolerances have been increased from the self tests.
+ */
+
+#define _GNU_SOURCE
+
+#include <inttypes.h>
+
+#include "memcontrol_common.h"
+
+#define TMPDIR "mntdir"
+
+static struct tst_cg_group *trunk_cg[3];
+static struct tst_cg_group *leaf_cg[4];
+static int fd = -1;
+
+enum checkpoints {
+       CHILD_IDLE
+};
+
+enum trunk_cg {
+       A,
+       B,
+       G
+};
+
+enum leaf_cg {
+       C,
+       D,
+       E,
+       F
+};
+
+static void cleanup_sub_groups(void)
+{
+       size_t i;
+
+       for (i = ARRAY_SIZE(leaf_cg); i > 0; i--) {
+               if (!leaf_cg[i - 1])
+                       continue;
+
+               leaf_cg[i - 1] = tst_cg_group_rm(leaf_cg[i - 1]);
+       }
+
+       for (i = ARRAY_SIZE(trunk_cg); i > 0; i--) {
+               if (!trunk_cg[i - 1])
+                       continue;
+
+               trunk_cg[i - 1] = tst_cg_group_rm(trunk_cg[i - 1]);
+       }
+}
+
+static void alloc_anon_in_child(const struct tst_cg_group *const cg,
+                               const size_t size)
+{
+       const pid_t pid = SAFE_FORK();
+
+       if (pid) {
+               tst_reap_children();
+               return;
+       }
+
+       SAFE_CG_PRINTF(cg, "cgroup.procs", "%d", getpid());
+
+       tst_res(TINFO, "Child %d in %s: Allocating anon: %"PRIdPTR,
+               getpid(), tst_cg_group_name(cg), size);
+       alloc_anon(size);
+
+       exit(0);
+}
+
+static void alloc_pagecache_in_child(const struct tst_cg_group *const cg,
+                                    const size_t size)
+{
+       const pid_t pid = SAFE_FORK();
+
+       if (pid) {
+               tst_reap_children();
+               return;
+       }
+

testcases/kernel/controllers/memcg/memcontrol04.c line 125

Quoted 10 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +10 -0
+       SAFE_CG_PRINTF(cg, "cgroup.procs", "%d", getpid());
+
+       tst_res(TINFO, "Child %d in %s: Allocating pagecache: %"PRIdPTR,
+               getpid(), tst_cg_group_name(cg), size);
+       alloc_pagecache(fd, size);
+
+       exit(0);
+}
+
+static void test_memcg_min(void)

test_memcg_low() ^

Quoted 83 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +11 -0
+{
+       long c[4];
+       unsigned int i;
+
+       fd = SAFE_OPEN(TMPDIR"/tmpfile", O_RDWR | O_CREAT, 0600);
+       trunk_cg[A] = tst_cg_group_mk(tst_cg, "trunk_A");
+
+       SAFE_CG_SCANF(trunk_cg[A], "memory.low", "%ld", c);
+       if (c[0]) {
+               tst_brk(TCONF,
+                       "memory.low already set to %ld on parent group",

c[0]);

testcases/kernel/controllers/memcg/memcontrol04.c new file +62 -0
+       }
+
+       SAFE_CG_PRINT(trunk_cg[A], "cgroup.subtree_control", "+memory");
+
+       SAFE_CG_PRINT(trunk_cg[A], "memory.max", "200M");
+       SAFE_CG_PRINT(trunk_cg[A], "memory.swap.max", "0");
+
+       trunk_cg[B] = tst_cg_group_mk(trunk_cg[A], "trunk_B");
+
+       SAFE_CG_PRINT(trunk_cg[B], "cgroup.subtree_control", "+memory");
+
+       trunk_cg[G] = tst_cg_group_mk(trunk_cg[A], "trunk_G");
+
+       for (i = 0; i < ARRAY_SIZE(leaf_cg); i++) {
+               leaf_cg[i] = tst_cg_group_mk(trunk_cg[B],
+                                                "leaf_%c", 'C' + i);
+
+               if (i == E)
+                       continue;
+
+               alloc_pagecache_in_child(leaf_cg[i], MB(50));
+       }
+
+       SAFE_CG_PRINT(trunk_cg[A], "memory.low", "50M");
+       SAFE_CG_PRINT(trunk_cg[B], "memory.low", "50M");
+       SAFE_CG_PRINT(leaf_cg[C], "memory.low", "75M");
+       SAFE_CG_PRINT(leaf_cg[D], "memory.low", "25M");
+       SAFE_CG_PRINT(leaf_cg[E], "memory.low", "500M");
+       SAFE_CG_PRINT(leaf_cg[F], "memory.low", "0");
+
+       alloc_anon_in_child(trunk_cg[G], MB(148));
+
+       SAFE_CG_SCANF(trunk_cg[B], "memory.current", "%ld", c);
+       TST_EXP_EXPR(values_close(c[0], MB(50), 5),
+                    "(A/B memory.current=%ld) ~= %d", c[0], MB(50));
+
+       for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
+               SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
+
+       TST_EXP_EXPR(values_close(c[0], MB(33), 20),
+                    "(A/B/C memory.current=%ld) ~= %d", c[0], MB(33));
+       TST_EXP_EXPR(values_close(c[1], MB(17), 20),
+                    "(A/B/D memory.current=%ld) ~= %d", c[1], MB(17));
+       TST_EXP_EXPR(values_close(c[2], 0, 1),
+                    "(A/B/E memory.current=%ld) ~= 0", c[2]);
+
+       alloc_anon_in_child(trunk_cg[G], MB(166));
+
+       for (i = 0; i < ARRAY_SIZE(leaf_cg); i++) {
+               long low, oom;
+
+               SAFE_CG_LINES_SCANF(leaf_cg[i], "memory.events",
+                                       "low %ld", &low);
+               SAFE_CG_LINES_SCANF(leaf_cg[i], "memory.events",
+                                       "oom %ld", &oom);
+
+               TST_EXP_EXPR(oom == 0, "(oom events=%ld) == 0", oom);
+
+               if (i < E)
+                       TST_EXP_EXPR(low > 0, "(low events=%ld) > 0", low)
+               else
+                       TST_EXP_EXPR(low == 0, "(low events=%ld) == 0",

low);

testcases/kernel/controllers/memcg/memcontrol04.c new file +7 -0
+       }
+
+       cleanup_sub_groups();
+       SAFE_CLOSE(fd);
+       SAFE_UNLINK(TMPDIR"/tmpfile");
+}
+

testcases/kernel/controllers/memcg/memcontrol04.c line 215

Quoted 10 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +10 -0
+static void cleanup(void)
+{
+       cleanup_sub_groups();
+       if (fd > -1)
+               SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+       .cleanup = cleanup,
+       .test_all = test_memcg_min,

test_memcg_low ^

Quoted 4 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +3 -0
+       .mount_device = 1,
+       .dev_min_size = 256,
+       .mntpoint = TMPDIR,

testcases/kernel/controllers/memcg/memcontrol04.c line 228

Quoted 10 lines
testcases/kernel/controllers/memcg/memcontrol04.c new file +10 -0
+       .all_filesystems = 1,
+       .skip_filesystems = (const char *const[]){
+               "exfat", "vfat", "fuse", "ntfs", "tmpfs", NULL
+       },
+       .forks_child = 1,
+       .needs_root = 1,
+       .needs_checkpoints = 1,
+       .needs_cgroup_ver = TST_CG_V2,
+       .needs_cgroup_ctrls = (const char *const[]){ "memory", NULL },
+};

Apart from the tiny issues and controversy on renaming in patch2/3. The test itself looks good if we decide to go separate with memcontrol03.c

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts='' mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache:
52428800
memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon:
155189248
memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~= 34603008
memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~= 17825792
memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon:
174063616
memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#14 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Quoted 25 lines · Li Wang

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache:
52428800
memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon:
155189248
memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~= 52428800
memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~= 34603008
memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~= 17825792
memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon:
174063616

Quoted 9 lines

memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

It looks like a logic issue here, as we do alloc_pagecache 50MB respectively in the leaf_cg[C, D, E, F] and only the 'memory.low' of leaf_cg[E] is large enough (500MB) to avoid triggering low event. The rest cgroups should all have low events, that kernel behavior is correct.

This failure should be fix with:

testcases/kernel/controllers/memcg/memcontrol04.c +1 -1
@@ -192,7 +192,7 @@ static void test_memcg_low(void)
 
                TST_EXP_EXPR(oom == 0, "(oom events=%ld) == 0", oom);
 
-               if (i < E)
+               if (i != E)
                        TST_EXP_EXPR(low > 0, "(low events=%ld) > 0", low)
                else
                        TST_EXP_EXPR(low == 0, "(low events=%ld) == 0",

low);

And better to add "leaf_cg%d" print in the output:
(to show the events from which cgroup)

    TST_EXP_EXPR(oom == 0, "(leaf_cg%d: oom events=%ld) == 0", i, oom);

    if (i != E)
            TST_EXP_EXPR(low > 0, "(leaf_cg%d: low events=%ld) > 0", i,
 low)
    else
             TST_EXP_EXPR(low == 0, "(leaf_cg%d: low events=%ld) == 0", i,

low);

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#15 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Quoted 40 lines · Li Wang
Quoted 25 lines · Li Wang

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache:
52428800
memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon:
155189248
memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~= 52428800
memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~= 34603008
memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~= 17825792
memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon:
174063616

Quoted 9 lines

memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

Quoted 3 lines

It looks like a logic issue here, as we do alloc_pagecache 50MB respectively in the leaf_cg[C, D, E, F] and only the 'memory.low'

My apologies, the leaf_cg[E] does not have 50MB page cache allocating, that is the main reason with no memory reclaims happening. '500MB' low boundary obviously overcommitment, so leaf_cg[E] will get the part of parent’s protection proportional to its actual memory usage. However, it doesn't matter for this case, leaf_cg[E] can get no event grows as well. Because it has no memory consumption at all.

The fix is still effective unless I misread something again:).

Quoted 36 lines

of leaf_cg[E] is large enough (500MB) to avoid triggering low event. The rest cgroups should all have low events, that kernel behavior is correct.

This failure should be fix with:

testcases/kernel/controllers/memcg/memcontrol04.c +1 -1
@@ -192,7 +192,7 @@ static void test_memcg_low(void)
 
                TST_EXP_EXPR(oom == 0, "(oom events=%ld) == 0", oom);
 
-               if (i < E)
+               if (i != E)
                        TST_EXP_EXPR(low > 0, "(low events=%ld) > 0", low)
                else
                        TST_EXP_EXPR(low == 0, "(low events=%ld) == 0",

low);

And better to add "leaf_cg%d" print in the output:
(to show the events from which cgroup)

    TST_EXP_EXPR(oom == 0, "(leaf_cg%d: oom events=%ld) == 0", i, oom);

    if (i != E)
            TST_EXP_EXPR(low > 0, "(leaf_cg%d: low events=%ld) > 0", i,
 low)
    else
             TST_EXP_EXPR(low == 0, "(leaf_cg%d: low events=%ld) == 0",

i, low);

--
Regards,
Li Wang

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#16 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Hello Li,

Quoted 32 lines · Li Wang

On Thu, Feb 10, 2022 at 2:23 PM Li Wang <[email protected]> wrote:

On Wed, Feb 9, 2022 at 7:05 PM Li Wang <[email protected]> wrote:

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts='' mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache: 52428800 memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon: 155189248 memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~= 34603008 memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~= 17825792 memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon: 174063616 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

It looks like a logic issue here, as we do alloc_pagecache 50MB respectively in the leaf_cg[C, D, E, F] and only the 'memory.low'

Quoted 6 lines

My apologies, the leaf_cg[E] does not have 50MB page cache allocating, that is the main reason with no memory reclaims happening. '500MB' low boundary obviously overcommitment, so leaf_cg[E] will get the part of parent’s protection proportional to its actual memory usage. However, it doesn't matter for this case, leaf_cg[E] can get no event grows as well. Because it has no memory consumption at all.

leaf_cg[F]'s memory.low == 0. So how can it have reclaim events where memory.current < memory.low?

Testing on the upstream kernel there are no low events in F.

Quoted 14 lines

The fix is still effective unless I misread something again:).

of leaf_cg[E] is large enough (500MB) to avoid triggering low event. The rest cgroups should all have low events, that kernel behavior is correct.

This failure should be fix with:

--- a/testcases/kernel/controllers/memcg/memcontrol04.c +++ b/testcases/kernel/controllers/memcg/memcontrol04.c @@ -192,7 +192,7 @@ static void test_memcg_low(void)

Quoted 8 lines
                 TST_EXP_EXPR(oom == 0, "(oom events=%ld) == 0", oom);

- if (i < E)
+ if (i != E)

                         TST_EXP_EXPR(low > 0, "(low events=%ld) > 0", low)
                 else
                         TST_EXP_EXPR(low == 0, "(low events=%ld) ==

0", low);

Note that I am just copying the original test. AFAICT the original did not expect there to be low events in F.

Quoted 11 lines

And better to add "leaf_cg%d" print in the output:
(to show the events from which cgroup)

     TST_EXP_EXPR(oom == 0, "(leaf_cg%d: oom events=%ld) == 0", i, oom);

     if (i != E)
             TST_EXP_EXPR(low > 0, "(leaf_cg%d: low events=%ld) > 0", i,  low)
     else
              TST_EXP_EXPR(low == 0, "(leaf_cg%d: low events=%ld) ==
     0", i, low);

+1, thanks!

Quoted 4 lines

--
Regards,
Li Wang

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#17 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Hi Richard,

Quoted 52 lines · Richard Palethorpe

Hello Li,

Quoted 9 lines · Li Wang

On Thu, Feb 10, 2022 at 2:23 PM Li Wang <[email protected]> wrote:

On Wed, Feb 9, 2022 at 7:05 PM Li Wang <[email protected]> wrote:

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra

opts=''

Quoted 3 lines

mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating

pagecache: 52428800

Quoted 1 line

memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating

pagecache: 52428800

Quoted 1 line

memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating

pagecache: 52428800

Quoted 1 line

memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon:

155189248

Quoted 1 line

memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~=

52428800

Quoted 1 line

memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~=

34603008

Quoted 1 line

memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~=

17825792

Quoted 2 lines

memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon:

174063616

Quoted 12 lines

memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

It looks like a logic issue here, as we do alloc_pagecache 50MB respectively in the leaf_cg[C, D, E, F] and only the 'memory.low'

Quoted 6 lines

My apologies, the leaf_cg[E] does not have 50MB page cache allocating, that is the main reason with no memory reclaims happening. '500MB' low boundary obviously overcommitment, so leaf_cg[E] will get the part of parent’s protection proportional to its actual memory usage. However, it doesn't matter for this case, leaf_cg[E] can get no event grows as well. Because it has no memory consumption at all.

Quoted 5 lines

leaf_cg[F]'s memory.low == 0. So how can it have reclaim events where memory.current < memory.low?

Testing on the upstream kernel there are no low events in F.

A bit weird...

From my test, it indeed has the events that occur. (even the original test fail as the same) And the leaf_cg[F]'s memory.current is almost 1MB.

# uname -r
5.17.0-rc4.liwang
...
tst_test.c:1521: TINFO: Testing on xfs
tst_test.c:996: TINFO: Formatting /dev/loop0 with xfs opts='' extra opts=''
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s
memcontrol04.c:118: TINFO: Child 21200 in leaf_C: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 21201 in leaf_D: Allocating pagecache:
52428800
memcontrol04.c:118: TINFO: Child 21202 in leaf_F: Allocating pagecache:
52428800
memcontrol04.c:99: TINFO: Child 21203 in trunk_G: Allocating anon: 155189248
memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54083584) ~= 52428800
memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=29822976) ~=
34603008
memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22061056) ~=
17825792
memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0
memcontrol04.c:99: TINFO: Child 21204 in trunk_G: Allocating anon: 174063616
memcontrol04.c:193: TPASS: Expect: (leaf_cg0: oom events=0) == 0
memcontrol04.c:196: TPASS: Expect: (leaf_cg0: low events=427) > 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg1: oom events=0) == 0
memcontrol04.c:196: TPASS: Expect: (leaf_cg1: low events=427) > 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg2: oom events=0) == 0
memcontrol04.c:198: TPASS: Expect: (leaf_cg2: low events=0) == 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg3: oom events=0) == 0
memcontrol04.c:198: TFAIL: Expect: (leaf_cg3: low events=415) == 0

Summary:

passed   44
failed   4
broken   0
skipped  0

warnings 0

# pwd
/root/linux-5.17-rc4/tools/testing/selftests/cgroup
# ./test_memcontrol
ok 1 test_memcg_subtree_control
ok 2 test_memcg_current
ok 3 test_memcg_min
not ok 4 test_memcg_low
Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#18 lore raw

Re: [LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Hello Li,

Quoted 89 lines · Li Wang

Hi Richard,

On Mon, Feb 14, 2022 at 2:07 PM Richard Palethorpe <[email protected]> wrote:

Hello Li,

Quoted 32 lines · Li Wang

On Thu, Feb 10, 2022 at 2:23 PM Li Wang <[email protected]> wrote:

On Wed, Feb 9, 2022 at 7:05 PM Li Wang <[email protected]> wrote:

Btw, there are some TFAILs from my manual run. (I will look into that try to figure it out tomorrow)

tst_test.c:1521: TINFO: Testing on ext4
tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts='' mke2fs 1.46.5 (30-Dec-2021)
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache: 52428800 memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon: 155189248 memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~= 34603008 memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~= 17825792 memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon: 174063616 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:196: TPASS: Expect: (low events=373) > 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TPASS: Expect: (low events=0) == 0 memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0 memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0

It looks like a logic issue here, as we do alloc_pagecache 50MB respectively in the leaf_cg[C, D, E, F] and only the 'memory.low'

Quoted 6 lines

My apologies, the leaf_cg[E] does not have 50MB page cache allocating, that is the main reason with no memory reclaims happening. '500MB' low boundary obviously overcommitment, so leaf_cg[E] will get the part of parent’s protection proportional to its actual memory usage. However, it doesn't matter for this case, leaf_cg[E] can get no event grows as well. Because it has no memory consumption at all.

leaf_cg[F]'s memory.low == 0. So how can it have reclaim events where memory.current < memory.low?

Testing on the upstream kernel there are no low events in F.

A bit weird...

From my test, it indeed has the events that occur. (even the original test fail as the same) And the leaf_cg[F]'s memory.current is almost 1MB.

# uname -r
5.17.0-rc4.liwang
...
tst_test.c:1521: TINFO: Testing on xfs
tst_test.c:996: TINFO: Formatting /dev/loop0 with xfs opts='' extra opts=''
tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s
memcontrol04.c:118: TINFO: Child 21200 in leaf_C: Allocating pagecache: 52428800
memcontrol04.c:118: TINFO: Child 21201 in leaf_D: Allocating pagecache: 52428800
memcontrol04.c:118: TINFO: Child 21202 in leaf_F: Allocating pagecache: 52428800
memcontrol04.c:99: TINFO: Child 21203 in trunk_G: Allocating anon: 155189248
memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54083584) ~= 52428800
memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=29822976) ~= 34603008
memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22061056) ~= 17825792
memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0
memcontrol04.c:99: TINFO: Child 21204 in trunk_G: Allocating anon: 174063616
memcontrol04.c:193: TPASS: Expect: (leaf_cg0: oom events=0) == 0
memcontrol04.c:196: TPASS: Expect: (leaf_cg0: low events=427) > 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg1: oom events=0) == 0
memcontrol04.c:196: TPASS: Expect: (leaf_cg1: low events=427) > 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg2: oom events=0) == 0
memcontrol04.c:198: TPASS: Expect: (leaf_cg2: low events=0) == 0
memcontrol04.c:193: TPASS: Expect: (leaf_cg3: oom events=0) == 0
memcontrol04.c:198: TFAIL: Expect: (leaf_cg3: low events=415) == 0

Summary:

passed   44
failed   4
broken   0
skipped  0

warnings 0

Quoted 8 lines
# pwd
/root/linux-5.17-rc4/tools/testing/selftests/cgroup
# ./test_memcontrol 
ok 1 test_memcg_subtree_control
ok 2 test_memcg_current
ok 3 test_memcg_min
not ok 4 test_memcg_low

I tested on 5.17-rc4 and it still passed. I also printed some more info

EXT4:

memcontrol04.c:118: TINFO: Child 507 in leaf_C: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 508 in leaf_D: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 509 in leaf_F: Allocating pagecache: 52428800 memcontrol04.c:99: TINFO: Child 510 in trunk_G: Allocating anon: 155189248 memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54157312) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=31477760) ~= 34603008 memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=21635072) ~= 17825792 memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:182: TINFO: A/B/F memory.current=970752 memcontrol04.c:99: TINFO: Child 511 in trunk_G: Allocating anon: 174063616 memcontrol04.c:195: TINFO: A: low events=1229, oom events=0 memcontrol04.c:195: TINFO: B: low events=1229, oom events=0 memcontrol04.c:195: TINFO: G: low events=0, oom events=0 memcontrol04.c:208: TPASS: Expect: (C oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (C low events=412) > 0 memcontrol04.c:208: TPASS: Expect: (D oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (D low events=412) > 0 memcontrol04.c:208: TPASS: Expect: (E oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (E low events=0) == 0 memcontrol04.c:208: TPASS: Expect: (F oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (F low events=0) == 0

XFS:

memcontrol04.c:118: TINFO: Child 523 in leaf_C: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 524 in leaf_D: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 525 in leaf_F: Allocating pagecache: 52428800 memcontrol04.c:99: TINFO: Child 526 in trunk_G: Allocating anon: 155189248 memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54038528) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30371840) ~= 34603008 memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22536192) ~= 17825792 memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:182: TINFO: A/B/F memory.current=942080 memcontrol04.c:99: TINFO: Child 527 in trunk_G: Allocating anon: 174063616 memcontrol04.c:195: TINFO: A: low events=1288, oom events=0 memcontrol04.c:195: TINFO: B: low events=1288, oom events=0 memcontrol04.c:195: TINFO: G: low events=0, oom events=0 memcontrol04.c:208: TPASS: Expect: (C oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (C low events=432) > 0 memcontrol04.c:208: TPASS: Expect: (D oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (D low events=432) > 0 memcontrol04.c:208: TPASS: Expect: (E oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (E low events=0) == 0 memcontrol04.c:208: TPASS: Expect: (F oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (F low events=0) == 0

BTRFS:

memcontrol04.c:118: TINFO: Child 548 in leaf_C: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 549 in leaf_D: Allocating pagecache: 52428800 memcontrol04.c:118: TINFO: Child 550 in leaf_F: Allocating pagecache: 52428800 memcontrol04.c:99: TINFO: Child 551 in trunk_G: Allocating anon: 155189248 memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54140928) ~= 52428800 memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=29540352) ~= 34603008 memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=21815296) ~= 17825792 memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0 memcontrol04.c:182: TINFO: A/B/F memory.current=2711552 memcontrol04.c:99: TINFO: Child 552 in trunk_G: Allocating anon: 174063616 memcontrol04.c:195: TINFO: A: low events=1245, oom events=0 memcontrol04.c:195: TINFO: B: low events=1245, oom events=0 memcontrol04.c:195: TINFO: G: low events=0, oom events=0 memcontrol04.c:208: TPASS: Expect: (C oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (C low events=423) > 0 memcontrol04.c:208: TPASS: Expect: (D oom events=0) == 0 memcontrol04.c:211: TPASS: Expect: (D low events=423) > 0 memcontrol04.c:208: TPASS: Expect: (E oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (E low events=0) == 0 memcontrol04.c:208: TPASS: Expect: (F oom events=0) == 0 memcontrol04.c:213: TPASS: Expect: (F low events=0) == 0

I will post another version of the patch-set with the extra debug info. I wonder if the low events in F are from the parent (B)?

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp