Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/)
@ 2025-06-05 14:29 Wei Gao via ltp
  2025-06-05  9:40 ` Petr Vorel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Wei Gao via ltp @ 2025-06-05 14:29 UTC (permalink / raw)
  To: ltp

When the CONFIG_RT_GROUP_SCHED=y config is set, test cases like sched_rr_get_interval01
will failed since limitation of RT processes with cgroup v2 cpu controller.
The limitation is RT processes have to be in the root cgroup before enabling cpu controller.
By default the shell will not running in root cgroup "0::/" since systemd will put shell
into 0::/user.slice/user-xx.slice/session-xx.scope, so ltp case run within shell will failed.
We can use this patch to workaround above limitation. If we agree on this patch, i will
continue do same patch to following cases:
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>
---
 .../sched_rr_get_interval/sched_rr_get_interval01.c         | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index b4d75bdcc..55516ec89 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -43,6 +43,12 @@ static void setup(void)
 
 	tp.type = tv->ts_type;
 
+	if (access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) {
+		int pid = getpid();
+
+		SAFE_FILE_PRINTF("/sys/fs/cgroup/cgroup.procs", "%d", pid);
+	}
+
 	if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1)
 		tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
 
-- 
2.49.0


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

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

end of thread, other threads:[~2025-08-22  1:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 14:29 [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Wei Gao via ltp
2025-06-05  9:40 ` Petr Vorel
2025-06-05 11:17   ` Andrea Cervesato via ltp
     [not found]   ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu>
2025-06-07  4:01     ` Wei Gao via ltp
2025-06-07 18:42     ` Wei Gao via ltp
     [not found]       ` <rugkmu3bcsrqgehibgy3dn7nsisuv6lip7b5cmo3bewq4zjcdn@zuo6hg25pqyz>
2025-06-09 13:33         ` Petr Vorel
2025-06-05 13:14 ` Cyril Hrubis
2025-06-10 22:14 ` [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y Wei Gao via ltp
2025-08-22  1:38   ` Li Wang via ltp
2025-08-22  1:42     ` Li Wang via ltp

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