On 2025/11/21 18:32, Sun Shaojie wrote:
> Hi, Ridong,
>
> On Thu, 20 Nov 2025 21:45:16, Chen Ridong wrote:
>> On 2025/11/20 21:07, Sun Shaojie wrote:
>>> I have carefully considered the scenario where parent effective CPUs are
>>> empty, which corresponds to the following two cases. (After apply this
>>> patch).
>>>
>>> root cgroup
>>> |
>>> A1
>>> / \
>>> A2 A3
>>>
>>> Case 1:
>>> Step:
>>> #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
>>>
>>> After step #4,
>>>
>>> | A1 | A2 | A3 |
>>> cpus_allowed | 0-1 | 0-1 | |
>>> effective_cpus | | 0-1 | |
>>> prstate | root | root | member |
>>>
>>> After step #4, A3's effective CPUs is empty.
>>>
>>
>> That may be a corner case is unexpected.
>>
>>> #5> echo "0-1" > A3/cpuset.cpus
>>>
>>
>> If we create subdirectories (e.g., A4, A5, ...) under the A1 cpuset and then
>> configure cpuset.cpus
>> for A1 (a common usage scenario), processes can no longer be migrated into
>> these subdirectories (A4,
>> A5, ...) afterward. However, prior to your patch, this migration was allowed.
>
> Are you referring to creating subdirectories (A4, A5, ...) after step #4?
> And what parameters should be configured for A1's cpuset.cpus?
> Could you provide a specific example?
>
#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
echo $$ > A4/cgroup.procs
echo "1" > A5/cpuset.cpus
echo $$ > A5/cgroup.procs
You might be going to argue that we haven't set the cpus for A4/A5..., yeah,
maybe a corner case.
However, it’s common practice to configure a cpuset’s cpus first and then
migrate processes—this is
a typical usage scenario.
> Additionally, processes cannot be migrated into a cgroup whose
> cpuset.cpus.effective is empty. However, this patch does not modify this
> behavior.
>
> So why does applying this patch enable such migration?
>
--
Best regards,
Ridong