mirror of https://gitee.com/openkylin/linux.git
Merge branch 'for-4.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup fixes from Tejun Heo: "Three late fixes for cgroup: Two cpuset ones, one trivial and the other pretty obscure, and a cgroup core fix for a bug which impacts cgroup v2 namespace users" * 'for-4.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: fix invalid controller enable rejections with cgroup namespace cpuset: fix non static symbol warning cpuset: handle race between CPU hotplug and cpuset_hotplug_work
This commit is contained in:
commit
8ab293e3a1
|
@ -3446,9 +3446,28 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
|
|||
* Except for the root, subtree_control must be zero for a cgroup
|
||||
* with tasks so that child cgroups don't compete against tasks.
|
||||
*/
|
||||
if (enable && cgroup_parent(cgrp) && !list_empty(&cgrp->cset_links)) {
|
||||
ret = -EBUSY;
|
||||
goto out_unlock;
|
||||
if (enable && cgroup_parent(cgrp)) {
|
||||
struct cgrp_cset_link *link;
|
||||
|
||||
/*
|
||||
* Because namespaces pin csets too, @cgrp->cset_links
|
||||
* might not be empty even when @cgrp is empty. Walk and
|
||||
* verify each cset.
|
||||
*/
|
||||
spin_lock_irq(&css_set_lock);
|
||||
|
||||
ret = 0;
|
||||
list_for_each_entry(link, &cgrp->cset_links, cset_link) {
|
||||
if (css_set_populated(link->cset)) {
|
||||
ret = -EBUSY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irq(&css_set_lock);
|
||||
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* save and update control masks and prepare csses */
|
||||
|
@ -3899,7 +3918,9 @@ void cgroup_file_notify(struct cgroup_file *cfile)
|
|||
* cgroup_task_count - count the number of tasks in a cgroup.
|
||||
* @cgrp: the cgroup in question
|
||||
*
|
||||
* Return the number of tasks in the cgroup.
|
||||
* Return the number of tasks in the cgroup. The returned number can be
|
||||
* higher than the actual number of tasks due to css_set references from
|
||||
* namespace roots and temporary usages.
|
||||
*/
|
||||
static int cgroup_task_count(const struct cgroup *cgrp)
|
||||
{
|
||||
|
|
|
@ -325,8 +325,7 @@ static struct file_system_type cpuset_fs_type = {
|
|||
/*
|
||||
* Return in pmask the portion of a cpusets's cpus_allowed that
|
||||
* are online. If none are online, walk up the cpuset hierarchy
|
||||
* until we find one that does have some online cpus. The top
|
||||
* cpuset always has some cpus online.
|
||||
* until we find one that does have some online cpus.
|
||||
*
|
||||
* One way or another, we guarantee to return some non-empty subset
|
||||
* of cpu_online_mask.
|
||||
|
@ -335,8 +334,20 @@ static struct file_system_type cpuset_fs_type = {
|
|||
*/
|
||||
static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask)
|
||||
{
|
||||
while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask))
|
||||
while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask)) {
|
||||
cs = parent_cs(cs);
|
||||
if (unlikely(!cs)) {
|
||||
/*
|
||||
* The top cpuset doesn't have any online cpu as a
|
||||
* consequence of a race between cpuset_hotplug_work
|
||||
* and cpu hotplug notifier. But we know the top
|
||||
* cpuset's effective_cpus is on its way to to be
|
||||
* identical to cpu_online_mask.
|
||||
*/
|
||||
cpumask_copy(pmask, cpu_online_mask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cpumask_and(pmask, cs->effective_cpus, cpu_online_mask);
|
||||
}
|
||||
|
||||
|
@ -2074,7 +2085,7 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css)
|
|||
* which could have been changed by cpuset just after it inherits the
|
||||
* state from the parent and before it sits on the cgroup's task list.
|
||||
*/
|
||||
void cpuset_fork(struct task_struct *task)
|
||||
static void cpuset_fork(struct task_struct *task)
|
||||
{
|
||||
if (task_css_is_root(task, cpuset_cgrp_id))
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue