tst_cgroup: Add "dmem" cgroup controller
PATCH 1/2 tst_cgroup: Add "dmem" cgroup controller
"dmem" cgroup controller [1] was added in 6.14 [2]. Add it to fix cgroup_regression_test.sh:
cgroup_regression_test 1 TINFO: Tested kernel: Linux susetest 6.14.0-1-default #1 SMP PREEMPT_DYNAMIC Tue Mar 25 06:23:18 UTC 2025 (ab99d4c) x86_64 x86_64 x86_64 GNU/Linux
...cgroup_regression_test 7 TBROK: 'tst_cgctl require' exited
New cgroup should be v2 only.
[1] https://docs.kernel.org/next/admin-guide/cgroup-v2.html#dmem
[2] https://kernelnewbies.org/Linux_6.14#dmem_cgroup_for_better_control_of_GPU_memory_resources
--- lib/tst_cgroup.c | 9 +++++++++ 1 file changed, 9 insertions(+)
lib/tst_cgroup.c +9 -0
@@ -84,6 +84,7 @@ enum cgroup_ctrl_indx {CTRL_MEMORY =1 ,CTRL_CPU ,CTRL_CPUSET , +CTRL_DMEM ,CTRL_IO ,CTRL_PIDS , CTRL_HUGETLB,
@@ -207,6 +208,12 @@ static const struct cgroup_file cpuset_ctrl_files[] = { { } }; +static const struct cgroup_file dmem_ctrl_files[] = { + {"dmem.capacity" ,NULL ,CTRL_DMEM }, + {"dmem.current" ,NULL ,CTRL_DMEM }, + { } +}; +static const struct cgroup_file io_ctrl_files[] = { {"io.stat" ,NULL ,CTRL_IO }, { }
@@ -218,6 +225,7 @@ static const struct cgroup_file pids_ctrl_files[] = { { } }; +static const struct cgroup_file hugetlb_ctrl_files[] = { { } };
@@ -289,6 +297,7 @@ static struct cgroup_ctrl controllers[] = {CGROUP_CTRL_MEMBER (perf_event,CTRL_PERFEVENT ),CGROUP_CTRL_MEMBER (debug,CTRL_DEBUG ),CGROUP_CTRL_MEMBER (rdma,CTRL_RDMA ), +CGROUP_CTRL_MEMBER (dmem,CTRL_DMEM ), CGROUP_CTRL_MEMBER(base, CTRL_BASE), { } };
Signature · 5 lines
2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 cgroup_regression_test.sh: simplify last controller detection
Simplify last controller detection by using awk only - replace tail and pipe with 'END' awk command (works also on Busybox).
--- testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +1 -1
@@ -352,7 +352,7 @@ test7() return fi - subsys=`tail -n 1 /proc/cgroups | awk '{ print $1 }'` + subsys=$(awk 'END{ print $1 }' /proc/cgroups) # remount to add new subsystems to the hierarchy while [ $i -le 2 ]; do
Signature · 5 lines
2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection
Quoted 5 lines · Petr Vorel
Simplify last controller detection by using awk only - replace tail and pipe with 'END' awk command (works also on Busybox).
Signed-off-by Petr Vorel <[email protected]>
---
Quoted 21 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +1
-2@@ -352,7 +352,7 @@ test7() return fi - subsys=`tail -n 1 /proc/cgroups | awk '{ print $1 }'` + subsys=$(awk 'END{ print $1 }' /proc/cgroups) # remount to add new subsystems to the hierarchy while [ $i -le 2 ]; do --2.49.0
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection
In reply to Petr VorelHi Petr,
for both patches.
Thank you,
Avinesh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Petr, Avinesh,
Quoted 34 lines · Petr Vorel
"dmem" cgroup controller [1] was added in 6.14 [2]. Add it to fix
cgroup_regression_test.sh:
cgroup_regression_test1 TINFO: Tested kernel: Linux susetest 6.14.0-1-default #1 SMPPREEMPT_DYNAMICTue Mar 25 06:23:18 UTC 2025 (ab99d4c)x86_64x86_64x86_64GNU/Linux
...cgroup_regression_test7 TBROK: 'tst_cgctlrequire' exitedNew cgroup should be v2 only.
[1] https://docs.kernel.org/next/admin-guide/cgroup-v2.html#dmem
[2]
https://kernelnewbies.org/Linux_6.14#dmem_cgroup_for_better_control_of_GPU_memory_resourcesReported-by Avinesh Kumar <[email protected]>Signed-off-by Petr Vorel <[email protected]>--- lib/tst_cgroup.c | 9 +++++++++ 1 file changed, 9 insertions(+)lib/tst_cgroup.c +1
-0@@ -84,6 +84,7 @@ enum cgroup_ctrl_indx {CTRL_MEMORY =1 ,CTRL_CPU ,CTRL_CPUSET , +CTRL_DMEM ,CTRL_IO ,CTRL_PIDS , CTRL_HUGETLB,
lib/tst_cgroup.c static const struct cgroup_file cpuset_ctrl_files[] = · line 215
Quoted 8 lines
lib/tst_cgroup.c +3
-0@@ -207,6 +208,12 @@ static const struct cgroup_file cpuset_ctrl_files[] = { { } }; +static const struct cgroup_file dmem_ctrl_files[] = { + {"dmem.capacity" ,NULL ,CTRL_DMEM }, + {"dmem.current" ,NULL ,CTRL_DMEM },
It is no harm to add more ctrl_files like dmem.max, dmem.min, dmem.low, which might be useful in the future.
Anyway, looks good to me.
Quoted 26 lines
lib/tst_cgroup.c +3
-0+ { } +}; +static const struct cgroup_file io_ctrl_files[] = {{ "io.stat", NULL, CTRL_IO }, { }lib/tst_cgroup.c +2
-1@@ -218,6 +225,7 @@ static const struct cgroup_file pids_ctrl_files[] = { { } }; +static const struct cgroup_file hugetlb_ctrl_files[] = { { } };@@ -289,6 +297,7 @@ static struct cgroup_ctrl controllers[] = {CGROUP_CTRL_MEMBER (perf_event,CTRL_PERFEVENT ),CGROUP_CTRL_MEMBER (debug,CTRL_DEBUG ),CGROUP_CTRL_MEMBER (rdma,CTRL_RDMA ), +CGROUP_CTRL_MEMBER (dmem,CTRL_DMEM ), CGROUP_CTRL_MEMBER(base, CTRL_BASE), { } }; --2.49.0
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li, Avinesh,
Quoted 3 lines
Hi Petr, Avinesh,
On Wed, Apr 16, 2025 at 6:08 AM Petr Vorel <[email protected]> wrote:
...
Quoted 7 lines
lib/tst_cgroup.c static const struct cgroup_file cpuset_ctrl_files[] = { · line 213
Quoted 3 lines
lib/tst_cgroup.c +3
-0+static const struct cgroup_file dmem_ctrl_files[] = { + {"dmem.capacity" ,NULL ,CTRL_DMEM }, + {"dmem.current" ,NULL ,CTRL_DMEM },It is no harm to add more
ctrl_fileslike dmem.max, dmem.min, dmem.low, which might be useful in the future.
Good idea, I added them before merge.
Quoted 1 line
Anyway, looks good to me.
Thank you both for your review.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp