Re: [PATCH] selftests/cgroup: Remove redu ndant cg_enter_current() call in test_core

Tao Cui <[email protected]>
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>

于 2026年7月17日 GMT+08:00 20:51:58,Tao Cui <[email protected]> 写道:
>
>
>在 2026/7/17 19:06, guojian 写道:
>> From: Jian Guo <[email protected]>
>> 
>> The test_cgcore_no_internal_process_constraint_on_threads test has two
>> back-to-back cg_enter_current(root) calls in its cleanup path.
>> 
>> A single cg_enter_current() call atomically migrates the entire thread
>> group to the target cgroup even for multi-threaded processes, and this
>> test creates no extra threads or child processes that would require a
>> second migration attempt. The second call is a harmless no-op once the
>> process is already in the root cgroup, but it is redundant and
>> inconsistent with the cleanup logic used in all other cgroup core
>> selftest cases.
>> 
>> Remove the duplicate call to clean up the code. No functional change is
>> intended.
>> 
>> Signed-off-by: Jian Guo <[email protected]>
>> ---
>>  tools/testing/selftests/cgroup/test_core.c | 1 -
>>  1 file changed, 1 deletion(-)
>> 
>> diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c
>> index 88ca832d4fc1..8e3f9b391e44 100644
>> --- a/tools/testing/selftests/cgroup/test_core.c
>> +++ b/tools/testing/selftests/cgroup/test_core.c
>> @@ -426,7 +426,6 @@ static int test_cgcore_no_internal_process_constraint_on_threads(const char *roo
>>  	ret = KSFT_PASS;
>>  
>>  cleanup:
>> -	cg_enter_current(root);
>>  	cg_enter_current(root);
>>  	if (child)
>>  		cg_destroy(child);
>
>Ran test_core on x86_64 (cgroup v2, all controllers available),
>12/12 pass, 0 fail, 0 skip — output byte-identical before and
>after the patch. Confirms the removed call is a no-op.
>
>Acked-by: Tao Cui <[email protected]>
>

Hi,

Correction to my previous reply:

Ran test_core on x86_64 (cgroup v2, all controllers available),
12/12 pass, 0 fail, 0 skip — output byte-identical before and after the patch. Confirms the removed call is a no-op.

Tested-by: Tao Cui <[email protected]>

Please ignore the earlier Acked-by tag.

Thanks,
Tao

>Thanks,
>Tao
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.