[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0729db54-98cf-4006-91d0-0ebda4dbc251@huawei.com>
Date: Thu, 18 Jul 2024 20:34:26 +0800
From: Gong Ruiqi <gongruiqi1@...wei.com>
To: Paul Moore <paul@...l-moore.com>
CC: Ondrej Mosnacek <omosnace@...hat.com>, Stephen Smalley
<stephen.smalley.work@...il.com>, <selinux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Wang Weiyang <wangweiyang2@...wei.com>
Subject: Re: [PATCH testsuite] tests/task_setscheduler: add cgroup v2 case for
moving proc to root cgroup
On 2024/07/18 0:17, Paul Moore wrote:
> On Tue, Jul 16, 2024 at 10:19 PM Gong Ruiqi <gongruiqi1@...wei.com> wrote:
>>
>> Ping.
>
> Dropping the LSM mailing list to cut down on the noise as it isn't a
> relevant mailing list.
>
> Ondrej currently maintains the selinux-testsuite project so I'd prefer
> to give him time to review/test/etc. the patch, but I see it has
> already been a couple of weeks without response. If Ondrej doesn't
> get to this patch by the end of the Linux v6.11 merge window I'll take
> a look then.
Thanks for your help!
>
> Where (what distribution, version, etc.) did you see this problem?
The problem occurred when I ran the testsuite on Fedora 40 with v6.6
kernel, and it was the only failed testcase.
>
> Thank you for sending this out :)
>
>> 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@...wei.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;
>>> }
>>
>
>
Powered by blists - more mailing lists