提交 5d8ba82c 编写于 作者: L Li Zefan 提交者: Tejun Heo

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: NLi Zefan <lizefan@huawei.com>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 be4c9dd7
...@@ -929,7 +929,8 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, ...@@ -929,7 +929,8 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
if (retval < 0) if (retval < 0)
return retval; return retval;
if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask)) if (!cpumask_subset(trialcs->cpus_allowed,
top_cpuset.cpus_allowed))
return -EINVAL; return -EINVAL;
} }
...@@ -1186,7 +1187,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs, ...@@ -1186,7 +1187,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
goto done; goto done;
if (!nodes_subset(trialcs->mems_allowed, if (!nodes_subset(trialcs->mems_allowed,
node_states[N_MEMORY])) { top_cpuset.mems_allowed)) {
retval = -EINVAL; retval = -EINVAL;
goto done; goto done;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册