[PATCH-next v4 4/6] cgroup/cpuset: Revert "remove global remote_children list"
From: Waiman Long
Date: Sun Nov 15 2026 - 20:24:13 EST
Commit 648d43da64f0 ("cpuset: remove global remote_children list") is being
reverted as there is now a need to iterate the list of remote partition
roots available.
Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
kernel/cgroup/cpuset-internal.h | 10 +++-------
kernel/cgroup/cpuset.c | 14 +++++++++++---
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
index 1ba94ffaff9d..f3fed906e7ee 100644
--- a/kernel/cgroup/cpuset-internal.h
+++ b/kernel/cgroup/cpuset-internal.h
@@ -154,13 +154,6 @@ 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;
-
/*
* Set to true when a remote partition is undergoing update.
*/
@@ -186,6 +179,9 @@ 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;
+
#ifdef CONFIG_CPUSETS_V1
struct fmeter fmeter; /* memory_pressure filter */
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 81481fa62cfe..0fe9f2731fee 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -148,6 +148,11 @@ static cpumask_var_t subpartitions_cpus; /* RWCS */
*/
static cpumask_var_t isolated_cpus; /* CSCB */
+/*
+ * List of remote partition root children
+ */
+static struct list_head remote_children; /* RWCS */
+
/*
* Set if housekeeping cpumasks are to be updated.
*/
@@ -286,6 +291,7 @@ struct cpuset top_cpuset = {
.flags = BIT(CS_CPU_EXCLUSIVE) |
BIT(CS_MEM_EXCLUSIVE) | BIT(CS_SCHED_LOAD_BALANCE),
.partition_root_state = PRS_ROOT,
+ .remote_sibling = LIST_HEAD_INIT(top_cpuset.remote_sibling),
.dl_bw_cpu = -1,
};
@@ -1213,7 +1219,7 @@ static void reset_partition_data(struct cpuset *cs)
static inline bool is_remote_partition(struct cpuset *cs)
{
- return cs->remote_partition;
+ return !list_empty(&cs->remote_sibling);
}
static inline bool is_local_partition(struct cpuset *cs)
@@ -1742,7 +1748,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);
- cs->remote_partition = true;
+ list_add(&cs->remote_sibling, &remote_children);
cpumask_copy(cs->effective_xcpus, tmp->new_cpus);
spin_unlock_irq(&callback_lock);
cpuset_force_rebuild();
@@ -1769,7 +1775,7 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
{
WARN_ON_ONCE(!is_remote_partition(cs));
spin_lock_irq(&callback_lock);
- cs->remote_partition = false;
+ list_del_init(&cs->remote_sibling);
partition_xcpus_del(cs->partition_root_state, NULL, cs->effective_xcpus);
if (cs->prs_err)
cs->partition_root_state = -cs->partition_root_state;
@@ -3677,6 +3683,7 @@ cpuset_css_alloc(struct cgroup_subsys_state *parent_css)
return ERR_PTR(-ENOMEM);
__set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
+ INIT_LIST_HEAD(&cs->remote_sibling);
cpuset1_init(cs);
/* Set CS_MEMORY_MIGRATE for default hierarchy */
@@ -3920,6 +3927,7 @@ int __init cpuset_init(void)
cpumask_setall(top_cpuset.exclusive_cpus);
nodes_setall(top_cpuset.effective_mems);
init_llist_node(&top_cpuset.attach_node);
+ INIT_LIST_HEAD(&remote_children);
cpuset1_init(&top_cpuset);
--
2.56.0