Skip to content

Commit 3c2acae

Browse files
Chen Ridonghtejun
authored andcommitted
cgroup/cpuset: remove use_parent_ecpus of cpuset
use_parent_ecpus is used to track whether the children are using the parent's effective_cpus. When a parent's effective_cpus is changed due to changes in a child partition's effective_xcpus, any child using parent'effective_cpus must call update_cpumasks_hier. However, if a child is not a valid partition, it is sufficient to determine whether to call update_cpumasks_hier based on whether the child's effective_cpus is going to change. To make the code more succinct, it is suggested to remove use_parent_ecpus. Signed-off-by: Chen Ridong <[email protected]> Reviewed-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 9414f68 commit 3c2acae

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

kernel/cgroup/cpuset.c

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ struct cpuset {
185185
/* partition root state */
186186
int partition_root_state;
187187

188-
/*
189-
* Default hierarchy only:
190-
* use_parent_ecpus - set if using parent's effective_cpus
191-
*/
192-
int use_parent_ecpus;
193-
194188
/*
195189
* number of SCHED_DEADLINE tasks attached to this cpuset, so that we
196190
* know when to rebuild associated root domain bandwidth information.
@@ -1505,11 +1499,8 @@ static void reset_partition_data(struct cpuset *cs)
15051499
if (is_cpu_exclusive(cs))
15061500
clear_bit(CS_CPU_EXCLUSIVE, &cs->flags);
15071501
}
1508-
if (!cpumask_and(cs->effective_cpus,
1509-
parent->effective_cpus, cs->cpus_allowed)) {
1510-
cs->use_parent_ecpus = true;
1502+
if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed))
15111503
cpumask_copy(cs->effective_cpus, parent->effective_cpus);
1512-
}
15131504
}
15141505

15151506
/*
@@ -1683,8 +1674,6 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
16831674
spin_lock_irq(&callback_lock);
16841675
isolcpus_updated = partition_xcpus_add(new_prs, NULL, tmp->new_cpus);
16851676
list_add(&cs->remote_sibling, &remote_children);
1686-
if (cs->use_parent_ecpus)
1687-
cs->use_parent_ecpus = false;
16881677
spin_unlock_irq(&callback_lock);
16891678
update_unbound_workqueue_cpumask(isolcpus_updated);
16901679

@@ -2309,13 +2298,8 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
23092298
* it is a partition root that has explicitly distributed
23102299
* out all its CPUs.
23112300
*/
2312-
if (is_in_v2_mode() && !remote && cpumask_empty(tmp->new_cpus)) {
2301+
if (is_in_v2_mode() && !remote && cpumask_empty(tmp->new_cpus))
23132302
cpumask_copy(tmp->new_cpus, parent->effective_cpus);
2314-
if (!cp->use_parent_ecpus)
2315-
cp->use_parent_ecpus = true;
2316-
} else if (cp->use_parent_ecpus) {
2317-
cp->use_parent_ecpus = false;
2318-
}
23192303

23202304
if (remote)
23212305
goto get_css;
@@ -2452,8 +2436,7 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
24522436
* Check all its siblings and call update_cpumasks_hier()
24532437
* if their effective_cpus will need to be changed.
24542438
*
2455-
* With the addition of effective_xcpus which is a subset of
2456-
* cpus_allowed. It is possible a change in parent's effective_cpus
2439+
* It is possible a change in parent's effective_cpus
24572440
* due to a change in a child partition's effective_xcpus will impact
24582441
* its siblings even if they do not inherit parent's effective_cpus
24592442
* directly.
@@ -2467,8 +2450,7 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
24672450
cpuset_for_each_child(sibling, pos_css, parent) {
24682451
if (sibling == cs)
24692452
continue;
2470-
if (!sibling->use_parent_ecpus &&
2471-
!is_partition_valid(sibling)) {
2453+
if (!is_partition_valid(sibling)) {
24722454
compute_effective_cpumask(tmp->new_cpus, sibling,
24732455
parent);
24742456
if (cpumask_equal(tmp->new_cpus, sibling->effective_cpus))
@@ -4128,7 +4110,6 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
41284110
if (is_in_v2_mode()) {
41294111
cpumask_copy(cs->effective_cpus, parent->effective_cpus);
41304112
cs->effective_mems = parent->effective_mems;
4131-
cs->use_parent_ecpus = true;
41324113
}
41334114
spin_unlock_irq(&callback_lock);
41344115

@@ -4194,9 +4175,6 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
41944175
is_sched_load_balance(cs))
41954176
update_flag(CS_SCHED_LOAD_BALANCE, cs, 0);
41964177

4197-
if (cs->use_parent_ecpus)
4198-
cs->use_parent_ecpus = false;
4199-
42004178
cpuset_dec();
42014179
clear_bit(CS_ONLINE, &cs->flags);
42024180

0 commit comments

Comments
 (0)