lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b94504d5-0a2b-48f4-a445-f2c83898e8d0@huaweicloud.com>
Date: Wed, 12 Nov 2025 08:44:55 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: Waiman Long <llong@...hat.com>, tj@...nel.org, hannes@...xchg.org,
 mkoutny@...e.com
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
 lujialin4@...wei.com, chenridong@...wei.com
Subject: Re: [PATCH -next v2 2/3] cpuset: remove global remote_children list



On 2025/11/11 22:56, Waiman Long wrote:
> On 11/11/25 8:24 AM, Chen Ridong wrote:
>> From: Chen Ridong <chenridong@...wei.com>
>>
>> The remote_children list is used to track all remote partitions attached
>> to a cpuset. However, it serves no other purpose. Using a boolean flag to
>> indicate whether a cpuset is a remote partition is a more direct approach,
>> making remote_children unnecessary.
>>
>> This patch replaces the list with a remote_partition flag in the cpuset
>> structure and removes remote_children entirely.
>>
>> Signed-off-by: Chen Ridong <chenridong@...wei.com>
>> ---
>>   kernel/cgroup/cpuset-internal.h | 10 +++++++---
>>   kernel/cgroup/cpuset.c          | 13 ++++---------
>>   2 files changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
>> index 5cac42c5fd97..01976c8e7d49 100644
>> --- a/kernel/cgroup/cpuset-internal.h
>> +++ b/kernel/cgroup/cpuset-internal.h
>> @@ -158,6 +158,13 @@ struct cpuset {
>>       /* partition root state */
>>       int partition_root_state;
>>   +    /*
>> +     * Whether cpuset is a remote partition.
>> +     * It used to be a list anchoring all remote partitions — we can switch back
>> +     * to a list if we need to iterate over the remote partitions.
>> +     */
>> +    bool remote_partition;
>> +
>>       /*
>>        * number of SCHED_DEADLINE tasks attached to this cpuset, so that we
>>        * know when to rebuild associated root domain bandwidth information.
>> @@ -172,9 +179,6 @@ struct cpuset {
>>       /* Handle for cpuset.cpus.partition */
>>       struct cgroup_file partition_file;
>>   -    /* Remote partition silbling list anchored at remote_children */
>> -    struct list_head remote_sibling;
>> -
>>       /* Used to merge intersecting subsets for generate_sched_domains */
>>       struct uf_node node;
>>   };
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index c90476d52f09..aff3ddc67393 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -94,9 +94,6 @@ static bool isolated_cpus_updating;
>>   static cpumask_var_t    boot_hk_cpus;
>>   static bool        have_boot_isolcpus;
>>   -/* List of remote partition root children */
>> -static struct list_head remote_children;
>> -
>>   /*
>>    * A flag to force sched domain rebuild at the end of an operation.
>>    * It can be set in
>> @@ -219,7 +216,7 @@ static struct cpuset top_cpuset = {
>>            BIT(CS_MEM_EXCLUSIVE) | BIT(CS_SCHED_LOAD_BALANCE),
>>       .partition_root_state = PRS_ROOT,
>>       .relax_domain_level = -1,
>> -    .remote_sibling = LIST_HEAD_INIT(top_cpuset.remote_sibling),
>> +    .remote_partition = false,
> I forgot to notify you that this init is also not needed. Anyway, this is a minor issue.

Hmm, I should have noticed that. This could be fixed if we send a related patch in the future, but I
don't think it's worth submitting a standalone patch.

>>   };
>>     /*
>> @@ -1572,7 +1569,7 @@ static int compute_trialcs_excpus(struct cpuset *trialcs, struct cpuset *cs)
>>     static inline bool is_remote_partition(struct cpuset *cs)
>>   {
>> -    return !list_empty(&cs->remote_sibling);
>> +    return cs->remote_partition;
>>   }
>>     static inline bool is_local_partition(struct cpuset *cs)
>> @@ -1621,7 +1618,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
>>         spin_lock_irq(&callback_lock);
>>       partition_xcpus_add(new_prs, NULL, tmp->new_cpus);
>> -    list_add(&cs->remote_sibling, &remote_children);
>> +    cs->remote_partition = true;
>>       cpumask_copy(cs->effective_xcpus, tmp->new_cpus);
>>       spin_unlock_irq(&callback_lock);
>>       update_isolation_cpumasks();
>> @@ -1651,7 +1648,7 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
>>       WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus));
>>         spin_lock_irq(&callback_lock);
>> -    list_del_init(&cs->remote_sibling);
>> +    cs->remote_partition = false;
>>       partition_xcpus_del(cs->partition_root_state, NULL, cs->effective_xcpus);
>>       if (cs->prs_err)
>>           cs->partition_root_state = -cs->partition_root_state;
>> @@ -3603,7 +3600,6 @@ cpuset_css_alloc(struct cgroup_subsys_state *parent_css)
>>       __set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
>>       fmeter_init(&cs->fmeter);
>>       cs->relax_domain_level = -1;
>> -    INIT_LIST_HEAD(&cs->remote_sibling);
>>         /* Set CS_MEMORY_MIGRATE for default hierarchy */
>>       if (cpuset_v2())
>> @@ -3874,7 +3870,6 @@ int __init cpuset_init(void)
>>       nodes_setall(top_cpuset.effective_mems);
>>         fmeter_init(&top_cpuset.fmeter);
>> -    INIT_LIST_HEAD(&remote_children);
>>         BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
>>   
> Reviewed-by: Waiman Long <longman@...hat.com>
> 

Thanks.

-- 
Best regards,
Ridong


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ