aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorLi Zefan <lizefan@huawei.com>2014-07-09 04:49:12 -0400
committerTejun Heo <tj@kernel.org>2014-07-09 15:56:17 -0400
commit5d8ba82c3a1f10b77bf39ee3e7670d6789a8d149 (patch)
tree9cc033ef2272e08b1b306c23140ef8f6e31e990a /kernel/cpuset.c
parentbe4c9dd7aee5ecf3e748da68c27b38bdca70d444 (diff)
cpuset: allow writing offlined masks to cpuset.cpus/mems
As the configured masks won't be limited by its parent, and the top cpuset's masks won't change when hotplug happens, it's natural to allow writing offlined masks to the configured masks. If on default hierarchy: # echo 0 > /sys/devices/system/cpu/cpu1/online # mkdir /cpuset/sub # echo 1 > /cpuset/sub/cpuset.cpus # cat /cpuset/sub/cpuset.cpus 1 If on legacy hierarchy: # echo 0 > /sys/devices/system/cpu/cpu1/online # mkdir /cpuset/sub # echo 1 > /cpuset/sub/cpuset.cpus -bash: echo: write error: Invalid argument Note the checks don't need to be gated by cgroup_on_dfl, because we've initialized top_cpuset.{cpus,mems}_allowed accordingly in cpuset_bind(). Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index c47cb940712e..65878a74a66b 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -929,7 +929,8 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
929 if (retval < 0) 929 if (retval < 0)
930 return retval; 930 return retval;
931 931
932 if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask)) 932 if (!cpumask_subset(trialcs->cpus_allowed,
933 top_cpuset.cpus_allowed))
933 return -EINVAL; 934 return -EINVAL;
934 } 935 }
935 936
@@ -1186,8 +1187,8 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
1186 goto done; 1187 goto done;
1187 1188
1188 if (!nodes_subset(trialcs->mems_allowed, 1189 if (!nodes_subset(trialcs->mems_allowed,
1189 node_states[N_MEMORY])) { 1190 top_cpuset.mems_allowed)) {
1190 retval = -EINVAL; 1191 retval = -EINVAL;
1191 goto done; 1192 goto done;
1192 } 1193 }
1193 } 1194 }