[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d719fdbc-515e-4386-b4d8-1d5fc0f7edf1@redhat.com>
Date: Sun, 19 Oct 2025 22:46:22 -0400
From: Waiman Long <llong@...hat.com>
To: Chen Ridong <chenridong@...weicloud.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 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
Powered by blists - more mailing lists