mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
cgroup/cpuset: Integrate compute_partition_effective_cpumask() into compute_effective_cpumask()
Update compute_effective_cpumask() to call compute_partition_effective_cpumask() directly if the given cpuset is a valid remote or local partition root. This simplifies the call sites where they are being involved. No functional change is expected. Suggested-by: Ridong Chen <ridong.chen@linux.dev> Signed-off-by: Waiman Long <longman@redhat.com> Acked-by: Guopeng Zhang <zhangguopeng@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
43b9f826e7
commit
518cec2def
|
|
@ -1606,8 +1606,6 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
|
|||
struct cpuset *child;
|
||||
bool populated = partition_is_populated(cs, NULL);
|
||||
|
||||
WARN_ON_ONCE(!is_partition_valid(cs));
|
||||
|
||||
/*
|
||||
* Check child partition roots to see if they should be invalidated
|
||||
* when all the effective_cpus will be used up and cs is populated.
|
||||
|
|
@ -1668,6 +1666,10 @@ static void compute_effective_cpumask(struct cpumask *new_cpus,
|
|||
{
|
||||
bool has_cpus;
|
||||
|
||||
if (is_remote_partition(cs) ||
|
||||
(is_partition_valid(cs) && is_partition_valid(parent)))
|
||||
return compute_partition_effective_cpumask(cs, new_cpus);
|
||||
|
||||
has_cpus = cpumask_and(new_cpus, cs->cpus_allowed, parent->effective_cpus);
|
||||
if (!has_cpus && is_in_v2_mode())
|
||||
cpumask_copy(new_cpus, parent->effective_cpus);
|
||||
|
|
@ -2268,10 +2270,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
|
|||
remote = (new_prs == old_prs);
|
||||
}
|
||||
|
||||
if (remote || (is_partition_valid(parent) && is_partition_valid(cp)))
|
||||
compute_partition_effective_cpumask(cp, tmp->new_cpus);
|
||||
else
|
||||
compute_effective_cpumask(tmp->new_cpus, cp, parent);
|
||||
compute_effective_cpumask(tmp->new_cpus, cp, parent);
|
||||
|
||||
if (remote)
|
||||
goto get_css; /* Ready to update cpuset data */
|
||||
|
|
@ -2352,10 +2351,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
|
|||
*/
|
||||
new_prs = cp->partition_root_state;
|
||||
if (new_prs != old_prs) {
|
||||
if (new_prs > 0)
|
||||
compute_partition_effective_cpumask(cp, tmp->new_cpus);
|
||||
else
|
||||
compute_effective_cpumask(tmp->new_cpus, cp, parent);
|
||||
compute_effective_cpumask(tmp->new_cpus, cp, parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3987,7 +3983,6 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp)
|
|||
static nodemask_t new_mems;
|
||||
bool cpus_updated;
|
||||
bool mems_updated;
|
||||
bool remote;
|
||||
int partcmd = -1;
|
||||
struct cpuset *parent;
|
||||
|
||||
|
|
@ -3999,21 +3994,12 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp)
|
|||
if (!tmp || !cs->partition_root_state)
|
||||
goto update_tasks;
|
||||
|
||||
/*
|
||||
* Compute effective_cpus for valid partition root, may invalidate
|
||||
* child partition roots if necessary.
|
||||
*/
|
||||
remote = is_remote_partition(cs);
|
||||
if (remote || (is_partition_valid(cs) && is_partition_valid(parent)))
|
||||
compute_partition_effective_cpumask(cs, &new_cpus);
|
||||
|
||||
if (remote && (cpumask_empty(subpartitions_cpus) ||
|
||||
(cpumask_empty(&new_cpus) &&
|
||||
partition_is_populated(cs, NULL)))) {
|
||||
if (is_remote_partition(cs) && (cpumask_empty(subpartitions_cpus) ||
|
||||
(cpumask_empty(&new_cpus) &&
|
||||
partition_is_populated(cs, NULL)))) {
|
||||
WRITE_ONCE(cs->prs_err, PERR_HOTPLUG);
|
||||
remote_partition_disable(cs, tmp);
|
||||
compute_effective_cpumask(&new_cpus, cs, parent);
|
||||
remote = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -4039,10 +4025,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp)
|
|||
|
||||
if (partcmd >= 0) {
|
||||
update_parent_effective_cpumask(cs, partcmd, NULL, tmp);
|
||||
if (is_partition_valid(cs)) {
|
||||
compute_partition_effective_cpumask(cs, &new_cpus);
|
||||
cpuset_force_rebuild();
|
||||
} else if (partcmd == partcmd_invalidate) {
|
||||
if (is_partition_valid(cs) || (partcmd == partcmd_invalidate)) {
|
||||
compute_effective_cpumask(&new_cpus, cs, parent);
|
||||
cpuset_force_rebuild();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user