Re: [PATCH v5] cpuset: Avoid invalidating sibling partitions on cpuset.cpus conflict.
From: Sun Shaojie
Date: Wed Nov 26 2025 - 07:30:21 EST
Hi, Ridong,
On Mon, 24 Nov 2025 19:33:54, Chen Ridong wrote:
>On 2025/11/24 18:20, Sun Shaojie wrote:
>> I'm sorry, I didn't quite understand the point you were trying to make with this example.
>>
>> If that's the case
>>
>> root cgroup
>> |
>> A1
>> / / \ \
>> A2 A3 A4 A5
>>
>> #1> echo "0-1" > A1/cpuset.cpus
>> #2> echo "root" > A1/cpuset.cpus.partition
>> #3> echo "0-1" > A2/cpuset.cpus
>> #4> echo "root" > A2/cpuset.cpus.partition
>> mkdir A4
>> mkdir A5
>> echo "0" > A4/cpuset.cpus
>
>If we don't apply your patch, A2 will be invalidated.
>
>> echo $$ > A4/cgroup.procs ->This will return an error because A4's effective CPUs are empty.
>> echo "1" > A5/cpuset.cpus
>> echo $$ > A5/cgroup.procs ->This will return an error because A5's effective CPUs are empty.
>>
>> Even with this patch applied, this result will not change.
>>
>
>You can have a try, the result I got:
>
># mkdir A1
># echo "0-1" > A1/cpuset.cpus
># echo "root" > A1/cpuset.cpus.partition
># cd A1/
># mkdir A2
># mkdir A4
># mkdir A5
># echo "0-1" > A2/cpuset.cpus
># echo "root" > A2/cpuset.cpus.partition
>#
># echo "0" > A4/cpuset.cpus
># cat A2/cpuset.cpus
>0-1
># cat A2/cpuset.cpus.partition
>root invalid
># cat A4/cpuset.cpus.effective
>0
A4's cpuset.cpus.effective is 0 because A2 changed from root to root invalid.
However, the purpose of this patch is precisely to keep A2 as "root".
Before 'echo "0" > A4/cpuset.cpus', A4 is aware that its cpuset.cpus.effective
is empty and that its parent's cpuset.cpus.effective is also empty. Therefore,
after executing 'echo "0" > A4/cpuset.cpus', A4 should anticipate the
possibility that it may not be allocated any available CPUs.
Thanks,
Sun Shaojie