cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it, "Michal Koutný" <mkoutny@suse.com>,
	"Li Wang" <liwang@redhat.com>,
	cgroups@vger.kernel.org
Subject: Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/)
Date: Thu, 5 Jun 2025 11:40:19 +0200	[thread overview]
Message-ID: <20250605094019.GA1206250@pevik> (raw)
In-Reply-To: <20250605142943.229010-1-wegao@suse.com>

Hi Wei, all,

> 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

Acked-by: Petr Vorel <pvorel@suse.cz>

LGTM.

@Michal @Li WDYT?

Kind regards,
Petr

> 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");

       reply	other threads:[~2025-06-05  9:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250605142943.229010-1-wegao@suse.com>
2025-06-05  9:40 ` Petr Vorel [this message]
2025-06-05 11:17   ` [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Andrea Cervesato
2025-06-05 15:56   ` Michal Koutný
2025-06-07 18:42     ` Wei Gao
2025-06-09 11:44       ` Michal Koutný
2025-06-09 13:33         ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605094019.GA1206250@pevik \
    --to=pvorel@suse.cz \
    --cc=cgroups@vger.kernel.org \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=mkoutny@suse.com \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).