mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gong Ruiqi <gongruiqi1@huawei.com>
To: Paul Moore <paul@paul-moore.com>,
	Ondrej Mosnacek <omosnace@redhat.com>,
	Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: <selinux@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Wang Weiyang <wangweiyang2@huawei.com>
Subject: Re: [PATCH testsuite] tests/task_setscheduler: add cgroup v2 case for moving proc to root cgroup
Date: Wed, 17 Jul 2024 10:18:57 +0800	[thread overview]
Message-ID: <9473d6eb-3f56-4c73-8e61-69111837c07b@huawei.com> (raw)
In-Reply-To: <20240702095401.16278-1-gongruiqi1@huawei.com>

Ping.

On 2024/07/02 17:54, GONG, Ruiqi wrote:
> Currently for systems that only enable cgroup v2, the test script would
> fail to move the target process into the root cgroup since the cgroup v1
> path is used, which therefore makes the testcase fail. Add cgroup v2
> handling here so that no matter which cgroup version the CPU controller
> is bound to, the target process can always be moved to the root CPU
> cgroup.
> 
> Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
> ---
>  tests/task_setscheduler/test | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/task_setscheduler/test b/tests/task_setscheduler/test
> index c2fe8c6..fa1efb1 100755
> --- a/tests/task_setscheduler/test
> +++ b/tests/task_setscheduler/test
> @@ -20,12 +20,17 @@ vec( $rin, fileno($f), 1 ) = 1;
>  select( $rin, undef, undef, 5 );
>  close($f);
>  
> -$cgroup_cpu = "/sys/fs/cgroup/cpu/tasks";
> -if ( -w $cgroup_cpu ) {
> -
> -    # We can only set the scheduler policy fo SCHED_{RR,FIFO} in the root
> -    # cgroup so move our target process to the root cgroup.
> -    open( my $fd, ">>", $cgroup_cpu );
> +# We can only set the scheduler policy fo SCHED_{RR,FIFO} in the root
> +# cgroup so move our target process to the root cgroup.
> +$cgroup_v1_cpu = "/sys/fs/cgroup/cpu/tasks";
> +if ( -w $cgroup_v1_cpu ) {
> +    open( my $fd, ">>", $cgroup_v1_cpu );
> +    print $fd $pid;
> +    close $fd;
> +}
> +$cgroup_v2 = "/sys/fs/cgroup/cgroup.procs";
> +if ( -w $cgroup_v2 ) {
> +    open( my $fd, ">>", $cgroup_v2 );
>      print $fd $pid;
>      close $fd;
>  }

       reply	other threads:[~2024-07-17  2:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240702095401.16278-1-gongruiqi1@huawei.com>
2024-07-17  2:18 ` Gong Ruiqi [this message]
2024-07-17 16:17   ` Paul Moore
2024-07-18 12:34     ` Gong Ruiqi
2024-07-26 13:43       ` Ondrej Mosnacek
2024-07-27  2:54         ` Gong Ruiqi
2024-07-29 10:28           ` Ondrej Mosnacek
2024-07-29 11:55             ` Stephen Smalley
2024-07-30  8:15               ` Ondrej Mosnacek
2024-07-30 11:30                 ` Stephen Smalley

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=9473d6eb-3f56-4c73-8e61-69111837c07b@huawei.com \
    --to=gongruiqi1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=wangweiyang2@huawei.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

all inboxes | Powered by JetHome®