[LTP] [PATCH v2 05/16] API/cgroup: Add more controllers to tst_cgroup
Luke Nowakowski-Krijger
luke.nowakowskikrijger@canonical.com
Sat Mar 5 00:18:15 CET 2022
Add the rest of the controllers that are tested in LTP controller tests
so that they can be mounted using the cgroup api.
Control files should be added on an as needed basis.
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
---
v2: remove rdma controller as that is not used in any LTP tests.
Remove control files that should be added on an as needed basis.
lib/tst_cgroup.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 91 insertions(+), 1 deletion(-)
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 90d91d94e..4e14a2895 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -83,8 +83,19 @@ enum cgroup_ctrl_indx {
CTRL_MEMORY = 1,
CTRL_CPU,
CTRL_CPUSET,
+ CTRL_IO,
+ CTRL_PIDS,
+ CTRL_HUGETLB,
+ CTRL_CPUACCT,
+ CTRL_DEVICES,
+ CTRL_FREEZER,
+ CTRL_NETCLS,
+ CTRL_NETPRIO,
+ CTRL_BLKIO,
+ CTRL_MISC,
+ CTRL_PERFEVENT
};
-#define CTRLS_MAX CTRL_CPUSET
+#define CTRLS_MAX CTRL_PERFEVENT
/* At most we can have one cgroup V1 tree for each controller and one
* (empty) v2 tree.
@@ -191,6 +202,52 @@ static const struct cgroup_file cpuset_ctrl_files[] = {
{ }
};
+static const struct cgroup_file pids_ctrl_files[] = {
+ { "pids.max", "pids.max", CTRL_PIDS },
+ { "pids.current", "pids.current", CTRL_PIDS },
+ { }
+};
+
+static const struct cgroup_file io_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file hugetlb_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file cpuacct_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file devices_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file freezer_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file netcls_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file netprio_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file blkio_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file misc_ctrl_files[] = {
+ { }
+};
+
+static const struct cgroup_file perf_event_ctrl_files[] = {
+ { }
+};
+
/* Lookup tree for item names. */
static struct cgroup_ctrl controllers[] = {
[0] = { "cgroup", cgroup_ctrl_files, 0, NULL, 0 },
@@ -203,6 +260,39 @@ static struct cgroup_ctrl controllers[] = {
[CTRL_CPUSET] = {
"cpuset", cpuset_ctrl_files, CTRL_CPUSET, NULL, 0
},
+ [CTRL_PIDS] = {
+ "pids", pids_ctrl_files, CTRL_PIDS, NULL, 0
+ },
+ [CTRL_IO] = {
+ "io", io_ctrl_files, CTRL_IO, NULL, 0
+ },
+ [CTRL_HUGETLB] = {
+ "hugetlb", hugetlb_ctrl_files, CTRL_HUGETLB, NULL, 0
+ },
+ [CTRL_CPUACCT] = {
+ "cpuacct", cpuacct_ctrl_files, CTRL_CPUACCT, NULL, 0
+ },
+ [CTRL_DEVICES] = {
+ "devices", devices_ctrl_files, CTRL_DEVICES, NULL, 0
+ },
+ [CTRL_FREEZER] = {
+ "freezer", freezer_ctrl_files, CTRL_FREEZER, NULL, 0
+ },
+ [CTRL_NETCLS] = {
+ "net_cls", netcls_ctrl_files, CTRL_NETCLS, NULL, 0
+ },
+ [CTRL_NETPRIO] = {
+ "net_prio", netprio_ctrl_files, CTRL_NETPRIO, NULL, 0
+ },
+ [CTRL_BLKIO] = {
+ "blkio", blkio_ctrl_files, CTRL_BLKIO, NULL, 0
+ },
+ [CTRL_MISC] = {
+ "misc", misc_ctrl_files, CTRL_MISC, NULL, 0
+ },
+ [CTRL_PERFEVENT] = {
+ "perf_event", perf_event_ctrl_files, CTRL_PERFEVENT, NULL, 0
+ },
{ }
};
--
2.32.0
More information about the ltp
mailing list