Skip to content

Commit b1034a6

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Ensure domain isolated CPUs stay in root or isolated partition
Commit 4a74e41 ("cgroup/cpuset: Check partition conflict with housekeeping setup") is supposed to ensure that domain isolated CPUs designated by the "isolcpus" boot command line option stay either in root partition or in isolated partitions. However, the required check wasn't implemented when a remote partition was created or when an existing partition changed type from "root" to "isolated". Even though this is a relatively minor issue, we still need to add the required prstate_housekeeping_conflict() call in the right places to ensure that the rule is strictly followed. The following steps can be used to reproduce the problem before this fix. # fmt -1 /proc/cmdline | grep isolcpus isolcpus=9 # cd /sys/fs/cgroup/ # echo +cpuset > cgroup.subtree_control # mkdir test # echo 9 > test/cpuset.cpus # echo isolated > test/cpuset.cpus.partition # cat test/cpuset.cpus.partition isolated # cat test/cpuset.cpus.effective 9 # echo root > test/cpuset.cpus.partition # cat test/cpuset.cpus.effective 9 # cat test/cpuset.cpus.partition root With this fix, the last few steps will become: # echo root > test/cpuset.cpus.partition # cat test/cpuset.cpus.effective 0-8,10-95 # cat test/cpuset.cpus.partition root invalid (partition config conflicts with housekeeping setup) Reported-by: Chen Ridong <chenridong@huawei.com> Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Chen Ridong <chenridong@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 6cfeddb commit b1034a6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

kernel/cgroup/cpuset.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,9 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
16101610
if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
16111611
cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
16121612
return PERR_INVCPUS;
1613-
if ((new_prs == PRS_ISOLATED) &&
1614-
!isolated_cpus_can_update(tmp->new_cpus, NULL))
1613+
if (((new_prs == PRS_ISOLATED) &&
1614+
!isolated_cpus_can_update(tmp->new_cpus, NULL)) ||
1615+
prstate_housekeeping_conflict(new_prs, tmp->new_cpus))
16151616
return PERR_HKEEPING;
16161617

16171618
spin_lock_irq(&callback_lock);
@@ -3062,8 +3063,9 @@ static int update_prstate(struct cpuset *cs, int new_prs)
30623063
* A change in load balance state only, no change in cpumasks.
30633064
* Need to update isolated_cpus.
30643065
*/
3065-
if ((new_prs == PRS_ISOLATED) &&
3066-
!isolated_cpus_can_update(cs->effective_xcpus, NULL))
3066+
if (((new_prs == PRS_ISOLATED) &&
3067+
!isolated_cpus_can_update(cs->effective_xcpus, NULL)) ||
3068+
prstate_housekeeping_conflict(new_prs, cs->effective_xcpus))
30673069
err = PERR_HKEEPING;
30683070
else
30693071
isolcpus_updated = true;

0 commit comments

Comments
 (0)