[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45f0970a-b266-4286-bff5-d1c35a878a34@huaweicloud.com>
Date: Mon, 20 Oct 2025 16:06:39 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: Waiman Long <llong@...hat.com>, tj@...nel.org, hannes@...xchg.org,
mkoutny@...e.com
Cc: cgups@...r.kernel.org, linux-kernel@...r.kernel.org,
lujialin4@...wei.com, chenridong@...wei.com
Subject: Re: [PATCH -next RFC 07/16] cpuset: introduce
local_partition_disable()
On 2025/10/20 10:46, Waiman Long wrote:
> On 9/28/25 3:12 AM, Chen Ridong wrote:
>> From: Chen Ridong <chenridong@...wei.com>
>>
>> The partition_disable() function introduced earlier can be extended to
>> handle local partition disablement.
>>
>> First, partition_disable() was enhanced to support local partitions by
>> properly managing the parent's nr_subparts counter and integrating
>> notification operations.
>>
>> Then, local_partition_disable() is introduced, which extracts the local
>> partition disable logic from update_parent_effective_cpumask(). It calls
>> partition_disable() to complete the disablement process.
>>
>> This refactoring establishes a clear separation between local and remote
>> partition operations while promoting code reuse through the shared
>> partition_disable() infrastructure.
>>
>> Signed-off-by: Chen Ridong <chenridong@...wei.com>
>> ---
>> kernel/cgroup/cpuset.c | 60 ++++++++++++++++++++++++++++++------------
>> 1 file changed, 43 insertions(+), 17 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index 154992cdfe9a..87ba43e93540 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -1576,13 +1576,20 @@ static void partition_disable(struct cpuset *cs, struct cpuset *parent,
>> int new_prs, enum prs_errcode prs_err)
>> {
>> bool isolcpus_updated;
>> + int old_prs;
>> lockdep_assert_held(&cpuset_mutex);
>> WARN_ON_ONCE(new_prs > 0);
>> WARN_ON_ONCE(!cpuset_v2());
>> + old_prs = cs->partition_root_state;
>> spin_lock_irq(&callback_lock);
>> list_del_init(&cs->remote_sibling);
>> + if (parent && is_partition_valid(parent) &&
>> + is_partition_valid(cs)) {
>> + parent->nr_subparts -= 1;
>> + WARN_ON_ONCE(parent->nr_subparts < 0);
>> + }
>> /* disable a partition should only delete exclusive cpus */
>> isolcpus_updated = partition_xcpus_del(cs->partition_root_state,
>> parent, cs->effective_xcpus);
>> @@ -1592,6 +1599,9 @@ static void partition_disable(struct cpuset *cs, struct cpuset *parent,
>> spin_unlock_irq(&callback_lock);
>> update_unbound_workqueue_cpumask(isolcpus_updated);
>> cpuset_force_rebuild();
>> + /* Clear exclusive flag; no errors are expected */
>> + update_partition_exclusive_flag(cs, new_prs);
>> + notify_partition_change(cs, old_prs);
>> }
>>
>
> Similarly, change to partition_disable() should be done previously in patch 4 ("cpuset: factor out
> partition_disable() function") for completeness.
>
> Cheers,
> Longman
>
Thank you, will update.
--
Best regards,
Ridong
Powered by blists - more mailing lists