Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller
@ 2025-04-15 22:08 Petr Vorel
  2025-04-15 22:08 ` [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection Petr Vorel
  2025-04-16  4:44 ` [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Li Wang via ltp
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2025-04-15 22:08 UTC (permalink / raw)
  To: ltp

"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

Reported-by: Avinesh Kumar <akumar@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_cgroup.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 73b696c588..0cb7282113 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -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),
 	{ }
 };
-- 
2.49.0


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection
  2025-04-15 22:08 [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Petr Vorel
@ 2025-04-15 22:08 ` Petr Vorel
  2025-04-16  4:44   ` Li Wang via ltp
  2025-04-16  7:35   ` Avinesh Kumar
  2025-04-16  4:44 ` [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Li Wang via ltp
  1 sibling, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2025-04-15 22:08 UTC (permalink / raw)
  To: ltp

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 <pvorel@suse.cz>
---
 testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index c241a5c4fc..276231fe8d 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -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


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller
  2025-04-15 22:08 [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Petr Vorel
  2025-04-15 22:08 ` [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection Petr Vorel
@ 2025-04-16  4:44 ` Li Wang via ltp
  2025-04-17  6:55   ` Petr Vorel
  1 sibling, 1 reply; 6+ messages in thread
From: Li Wang via ltp @ 2025-04-16  4:44 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr, Avinesh,

On Wed, Apr 16, 2025 at 6:08 AM Petr Vorel <pvorel@suse.cz> wrote:

> "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
>
> Reported-by: Avinesh Kumar <akumar@suse.de>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  lib/tst_cgroup.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index 73b696c588..0cb7282113 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -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 },
>

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.

Tested-by: Li Wang <liwang@redhat.com>
Reviewed-by: Li Wang <liwang@redhat.com>




> +       { }
> +};
> +
>  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),
>         { }
>  };
> --
> 2.49.0
>
>

-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection
  2025-04-15 22:08 ` [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection Petr Vorel
@ 2025-04-16  4:44   ` Li Wang via ltp
  2025-04-16  7:35   ` Avinesh Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Li Wang via ltp @ 2025-04-16  4:44 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Wed, Apr 16, 2025 at 6:09 AM Petr Vorel <pvorel@suse.cz> wrote:

> 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 <pvorel@suse.cz>
>

Tested-by: Li Wang <liwang@redhat.com>
Reviewed-by: Li Wang <liwang@redhat.com>

---
>  testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> index c241a5c4fc..276231fe8d 100755
> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> @@ -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
>
>

-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection
  2025-04-15 22:08 ` [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection Petr Vorel
  2025-04-16  4:44   ` Li Wang via ltp
@ 2025-04-16  7:35   ` Avinesh Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Avinesh Kumar @ 2025-04-16  7:35 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

Reviewed-by: Avinesh Kumar <akumar@suse.de>
for both patches.

Thank you,
Avinesh





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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller
  2025-04-16  4:44 ` [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Li Wang via ltp
@ 2025-04-17  6:55   ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2025-04-17  6:55 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li, Avinesh,

> Hi Petr, Avinesh,

> On Wed, Apr 16, 2025 at 6:08 AM Petr Vorel <pvorel@suse.cz> wrote:

...
> > +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.

Good idea, I added them before merge.

> Anyway, looks good to me.

Thank you both for your review.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-17  6:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 22:08 [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Petr Vorel
2025-04-15 22:08 ` [LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection Petr Vorel
2025-04-16  4:44   ` Li Wang via ltp
2025-04-16  7:35   ` Avinesh Kumar
2025-04-16  4:44 ` [LTP] [PATCH 1/2] tst_cgroup: Add "dmem" cgroup controller Li Wang via ltp
2025-04-17  6:55   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox