[PATCH 16/17] cgroup/cpuset: Fix isolated accounting on propagated invalidation
Guopeng Zhang <[email protected]>
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest |
|---|---|
| Message-ID | <[email protected]> |
From: Guopeng Zhang <[email protected]> update_cpumasks_hier() invalidates a local partition when its parent becomes a member or an invalid partition. Its CPUs return to the nearest valid partition ancestor, but isolated_cpus still reflects the old partition type. Update isolated_cpus before resetting a local partition whose state changes from valid to invalid below an invalid parent. Remote partitions are excluded because remote_partition_disable() already updates their isolated CPU accounting. Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions") Signed-off-by: Guopeng Zhang <[email protected]> --- kernel/cgroup/cpuset.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 9e13fc962f41..4af8e348e838 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2236,9 +2236,12 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp, cpuset_for_each_descendant_pre(cp, pos_css, cs) { struct cpuset *parent = parent_cs(cp); bool remote = is_remote_partition(cp); + bool was_remote = remote; bool update_parent = false; + int owner_prs; old_prs = new_prs = cp->partition_root_state; + owner_prs = old_prs; /* * For child remote partition root (!= cs), we need to call @@ -2338,7 +2341,18 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp, new_prs = cp->partition_root_state; } + /* + * With no valid parent partition left, this partition's CPUs + * return to the nearest valid partition ancestor. + */ + if (!was_remote && old_prs > 0 && new_prs < 0 && + !is_partition_valid(parent)) + owner_prs = partition_owner(cp)->partition_root_state; + spin_lock_irq(&callback_lock); + if (old_prs != owner_prs) + isolated_cpus_update(old_prs, owner_prs, + cp->effective_xcpus); cpumask_copy(cp->effective_cpus, tmp->new_cpus); cp->partition_root_state = new_prs; /* -- 2.43.0