Skip to content

Commit 44cd990

Browse files
Chen Ridonggregkh
authored andcommitted
cpuset: fix failure to enable isolated partition when containing isolcpus
[ Upstream commit 216217e ] The 'isolcpus' parameter specified at boot time can be assigned to an isolated partition. While it is valid put the 'isolcpus' in an isolated partition, attempting to change a member cpuset to an isolated partition will fail if the cpuset contains any 'isolcpus'. For example, the system boots with 'isolcpus=9', and the following configuration works correctly: # cd /sys/fs/cgroup/ # mkdir test # echo 1 > test/cpuset.cpus # echo isolated > test/cpuset.cpus.partition # cat test/cpuset.cpus.partition isolated # echo 9 > test/cpuset.cpus # cat test/cpuset.cpus.partition isolated # cat test/cpuset.cpus 9 However, the following steps to convert a member cpuset to an isolated partition will fail: # cd /sys/fs/cgroup/ # mkdir test # echo 9 > test/cpuset.cpus # echo isolated > test/cpuset.cpus.partition # cat test/cpuset.cpus.partition isolated invalid (partition config conflicts with housekeeping setup) The issue occurs because the new partition state (new_prs) is used for validation against housekeeping constraints before it has been properly updated. To resolve this, move the assignment of new_prs before the housekeeping validation check when enabling a root partition. Fixes: 4a74e41 ("cgroup/cpuset: Check partition conflict with housekeeping setup") Signed-off-by: Chen Ridong <[email protected]> Reviewed-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1341b78 commit 44cd990

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/cgroup/cpuset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
17161716
xcpus = tmp->delmask;
17171717
if (compute_effective_exclusive_cpumask(cs, xcpus, NULL))
17181718
WARN_ON_ONCE(!cpumask_empty(cs->exclusive_cpus));
1719+
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
17191720

17201721
/*
17211722
* Enabling partition root is not allowed if its
@@ -1748,7 +1749,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
17481749

17491750
deleting = true;
17501751
subparts_delta++;
1751-
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
17521752
} else if (cmd == partcmd_disable) {
17531753
/*
17541754
* May need to add cpus back to parent's effective_cpus

0 commit comments

Comments
 (0)