Skip to content

Commit 648d43d

Browse files
Chen Ridonghtejun
authored andcommitted
cpuset: remove global remote_children list
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 <[email protected]> Reviewed-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 0241e9e commit 648d43d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

kernel/cgroup/cpuset-internal.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ struct cpuset {
158158
/* partition root state */
159159
int partition_root_state;
160160

161+
/*
162+
* Whether cpuset is a remote partition.
163+
* It used to be a list anchoring all remote partitions — we can switch back
164+
* to a list if we need to iterate over the remote partitions.
165+
*/
166+
bool remote_partition;
167+
161168
/*
162169
* number of SCHED_DEADLINE tasks attached to this cpuset, so that we
163170
* know when to rebuild associated root domain bandwidth information.
@@ -172,9 +179,6 @@ struct cpuset {
172179
/* Handle for cpuset.cpus.partition */
173180
struct cgroup_file partition_file;
174181

175-
/* Remote partition silbling list anchored at remote_children */
176-
struct list_head remote_sibling;
177-
178182
/* Used to merge intersecting subsets for generate_sched_domains */
179183
struct uf_node node;
180184
};

kernel/cgroup/cpuset.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ static bool isolated_cpus_updating;
9494
static cpumask_var_t boot_hk_cpus;
9595
static bool have_boot_isolcpus;
9696

97-
/* List of remote partition root children */
98-
static struct list_head remote_children;
99-
10097
/*
10198
* A flag to force sched domain rebuild at the end of an operation.
10299
* It can be set in
@@ -219,7 +216,7 @@ static struct cpuset top_cpuset = {
219216
BIT(CS_MEM_EXCLUSIVE) | BIT(CS_SCHED_LOAD_BALANCE),
220217
.partition_root_state = PRS_ROOT,
221218
.relax_domain_level = -1,
222-
.remote_sibling = LIST_HEAD_INIT(top_cpuset.remote_sibling),
219+
.remote_partition = false,
223220
};
224221

225222
/*
@@ -1572,7 +1569,7 @@ static int compute_trialcs_excpus(struct cpuset *trialcs, struct cpuset *cs)
15721569

15731570
static inline bool is_remote_partition(struct cpuset *cs)
15741571
{
1575-
return !list_empty(&cs->remote_sibling);
1572+
return cs->remote_partition;
15761573
}
15771574

15781575
static inline bool is_local_partition(struct cpuset *cs)
@@ -1621,7 +1618,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
16211618

16221619
spin_lock_irq(&callback_lock);
16231620
partition_xcpus_add(new_prs, NULL, tmp->new_cpus);
1624-
list_add(&cs->remote_sibling, &remote_children);
1621+
cs->remote_partition = true;
16251622
cpumask_copy(cs->effective_xcpus, tmp->new_cpus);
16261623
spin_unlock_irq(&callback_lock);
16271624
update_isolation_cpumasks();
@@ -1651,7 +1648,7 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
16511648
WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus));
16521649

16531650
spin_lock_irq(&callback_lock);
1654-
list_del_init(&cs->remote_sibling);
1651+
cs->remote_partition = false;
16551652
partition_xcpus_del(cs->partition_root_state, NULL, cs->effective_xcpus);
16561653
if (cs->prs_err)
16571654
cs->partition_root_state = -cs->partition_root_state;
@@ -3603,7 +3600,6 @@ cpuset_css_alloc(struct cgroup_subsys_state *parent_css)
36033600
__set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
36043601
fmeter_init(&cs->fmeter);
36053602
cs->relax_domain_level = -1;
3606-
INIT_LIST_HEAD(&cs->remote_sibling);
36073603

36083604
/* Set CS_MEMORY_MIGRATE for default hierarchy */
36093605
if (cpuset_v2())
@@ -3874,7 +3870,6 @@ int __init cpuset_init(void)
38743870
nodes_setall(top_cpuset.effective_mems);
38753871

38763872
fmeter_init(&top_cpuset.fmeter);
3877-
INIT_LIST_HEAD(&remote_children);
38783873

38793874
BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
38803875

0 commit comments

Comments
 (0)