[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85e776e6-110e-4c04-88b7-93059db8f74c@redhat.com>
Date: Sun, 19 Oct 2025 22:44:41 -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 06/16] cpuset: introduce
local_partition_enable()
On 9/28/25 3:12 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@...wei.com>
>
> The partition_enable() function introduced in the previous patch can be
> reused to enable local partitions.
>
> First, partition_enable() was enhanced to support local partition enabling
> by properly handling parent's nr_subparts counter and adding notification
> operations.
>
> Then, the local_partition_enable() function is introduced, which factors
> out the local partition enablement logic from
> update_parent_effective_cpumask(). After passing local partition validation
> checks, it delegates to partition_enable() to complete the partition setup.
>
> This refactoring creates a clear separation between local and remote
> partition operations while maintaining code reuse through the shared
> partition_enable() infrastructure.
>
> Signed-off-by: Chen Ridong <chenridong@...wei.com>
> ---
> kernel/cgroup/cpuset.c | 111 +++++++++++++++++++++++++++--------------
> 1 file changed, 74 insertions(+), 37 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 0e2f95daf459..154992cdfe9a 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1539,6 +1539,7 @@ static void partition_enable(struct cpuset *cs, struct cpuset *parent,
> int new_prs, struct cpumask *new_excpus)
> {
> bool isolcpus_updated;
> + int old_prs;
>
> lockdep_assert_held(&cpuset_mutex);
> WARN_ON_ONCE(new_prs <= 0);
> @@ -1547,15 +1548,21 @@ static void partition_enable(struct cpuset *cs, struct cpuset *parent,
> if (cs->partition_root_state == new_prs)
> return;
>
> + old_prs = cs->partition_root_state;
> spin_lock_irq(&callback_lock);
> /* enable partition should only add exclusive cpus */
> isolcpus_updated = partition_xcpus_add(new_prs, parent, new_excpus);
> - list_add(&cs->remote_sibling, &remote_children);
> + /* enable remote partition */
> + if (!parent)
> + list_add(&cs->remote_sibling, &remote_children);
> + else if (!is_partition_valid(cs))
> + parent->nr_subparts += 1;
> cpumask_copy(cs->effective_xcpus, new_excpus);
> partition_state_update(cs, new_prs, PERR_NONE);
> spin_unlock_irq(&callback_lock);
> update_unbound_workqueue_cpumask(isolcpus_updated);
> cpuset_force_rebuild();
> + notify_partition_change(cs, old_prs);
> }
As commented in an earlier patch, the partition_enable() chnage should
be moved there.
Cheers,
Longman
Powered by blists - more mailing lists