Skip to content

Commit 216217e

Browse files
Chen Ridonghtejun
authored andcommitted
cpuset: fix failure to enable isolated partition when containing isolcpus
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]>
1 parent 1f1cb5d commit 216217e

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
@@ -1806,6 +1806,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
18061806
xcpus = tmp->delmask;
18071807
if (compute_excpus(cs, xcpus))
18081808
WARN_ON_ONCE(!cpumask_empty(cs->exclusive_cpus));
1809+
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
18091810

18101811
/*
18111812
* Enabling partition root is not allowed if its
@@ -1838,7 +1839,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
18381839

18391840
deleting = true;
18401841
subparts_delta++;
1841-
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
18421842
} else if (cmd == partcmd_disable) {
18431843
/*
18441844
* May need to add cpus back to parent's effective_cpus

0 commit comments

Comments
 (0)