mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
cpuset: initialize top_cpuset's configured masks at mount
We now have to support different behaviors for default hierachy and legacy hiearchy, top_cpuset's configured masks need to be initialized accordingly. Suppose we've offlined cpu1. On default hierarchy: # mount -t cgroup -o __DEVEL__sane_behavior xxx /cpuset # cat /cpuset/cpuset.cpus 0-15 On legacy hierarchy: # mount -t cgroup xxx /cpuset # cat /cpuset/cpuset.cpus 0,2-15 Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
8b5f1c52dc
commit
39bd0d15ec
1 changed files with 28 additions and 9 deletions
|
@ -2015,16 +2015,35 @@ static void cpuset_css_free(struct cgroup_subsys_state *css)
|
||||||
kfree(cs);
|
kfree(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cpuset_bind(struct cgroup_subsys_state *root_css)
|
||||||
|
{
|
||||||
|
mutex_lock(&cpuset_mutex);
|
||||||
|
mutex_lock(&callback_mutex);
|
||||||
|
|
||||||
|
if (cgroup_on_dfl(root_css->cgroup)) {
|
||||||
|
cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask);
|
||||||
|
top_cpuset.mems_allowed = node_possible_map;
|
||||||
|
} else {
|
||||||
|
cpumask_copy(top_cpuset.cpus_allowed,
|
||||||
|
top_cpuset.effective_cpus);
|
||||||
|
top_cpuset.mems_allowed = top_cpuset.effective_mems;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&callback_mutex);
|
||||||
|
mutex_unlock(&cpuset_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
struct cgroup_subsys cpuset_cgrp_subsys = {
|
struct cgroup_subsys cpuset_cgrp_subsys = {
|
||||||
.css_alloc = cpuset_css_alloc,
|
.css_alloc = cpuset_css_alloc,
|
||||||
.css_online = cpuset_css_online,
|
.css_online = cpuset_css_online,
|
||||||
.css_offline = cpuset_css_offline,
|
.css_offline = cpuset_css_offline,
|
||||||
.css_free = cpuset_css_free,
|
.css_free = cpuset_css_free,
|
||||||
.can_attach = cpuset_can_attach,
|
.can_attach = cpuset_can_attach,
|
||||||
.cancel_attach = cpuset_cancel_attach,
|
.cancel_attach = cpuset_cancel_attach,
|
||||||
.attach = cpuset_attach,
|
.attach = cpuset_attach,
|
||||||
.base_cftypes = files,
|
.bind = cpuset_bind,
|
||||||
.early_init = 1,
|
.base_cftypes = files,
|
||||||
|
.early_init = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue