[LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y

Li Wang liwang@redhat.com
Fri Aug 22 03:38:02 CEST 2025


On Tue, Jun 10, 2025 at 6:15 PM Wei Gao via ltp <ltp@lists.linux.it> wrote:

> RT_GROUP scheduling is cgroup v1 feature as of now. So we need skip test
> cases
> for cgroup v2 with CONFIG_RT_GROUP_SCHED=y.
>
> Skip cases list:
> sched_rr_get_interval01
> sched_rr_get_interval02
> sched_rr_get_interval03
> sched_setparam02
> sched_getscheduler01
>
> Fixes: https://github.com/linux-test-project/ltp/issues/1245
> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
>  include/tst_cgroup.h                                  |  2 ++
>  lib/tst_cgroup.c                                      | 11 +++++++++++
>  .../sched_getscheduler/sched_getscheduler01.c         |  2 ++
>  .../sched_rr_get_interval/sched_rr_get_interval01.c   |  2 ++
>  .../sched_rr_get_interval/sched_rr_get_interval02.c   |  2 ++
>  .../sched_rr_get_interval/sched_rr_get_interval03.c   |  2 ++
>  .../kernel/syscalls/sched_setparam/sched_setparam02.c |  2 ++
>  7 files changed, 23 insertions(+)
>
> diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
> index d2b5224a0..0f0f44ec3 100644
> --- a/include/tst_cgroup.h
> +++ b/include/tst_cgroup.h
> @@ -256,4 +256,6 @@ int safe_cg_occursin(const char *file, const int
> lineno,
>
>  int tst_cg_memory_recursiveprot(struct tst_cg_group *cg);
>
> +void tst_check_rt_group_sched_support(void);
> +
>  #endif /* TST_CGROUP_H */
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index 36602402d..4ebdf701f 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -16,6 +16,7 @@
>  #include "lapi/fcntl.h"
>  #include "lapi/mount.h"
>  #include "tst_safe_file_at.h"
> +#include "tst_kconfig.h"
>
>  struct cgroup_root;
>
> @@ -1531,3 +1532,13 @@ int tst_cg_memory_recursiveprot(struct tst_cg_group
> *cg)
>                 return cg->dirs_by_ctrl[0]->dir_root->memory_recursiveprot;
>         return 0;
>  }
> +
> +void tst_check_rt_group_sched_support(void)
> +{
> +       static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y",
> NULL};
> +
> +       if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) &&
> !tst_kconfig_check(kconf)) {
>

Here is what we assume the cgrup v2 default mount path, but
better to use cgroup_v2_mounted() in case some test env is not
mount cgroup on the path.

I made the below change and pushed:

--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -1537,7 +1537,9 @@ void tst_check_rt_group_sched_support(void)
 {
        static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y",
NULL};

-       if (cgroup_v2_mounted() && !tst_kconfig_check(kconf)) {
+       tst_cg_scan();
+
+       if (cgroup_v2_mounted() && tst_kconfig_check(kconf)) {
                tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on
cgroupv2");
        }



-- 
Regards,
Li Wang


More information about the ltp mailing list