Messages in this thread Patch in this message | | | Date | Wed, 25 Nov 2015 20:01:17 -0200 | From | Marcelo Tosatti <> | Subject | [PATCH] cgroups: move cpuset specific checks from generic code to cpuset_can_attach |
| |
Move PF_NO_SETAFFINITY check to cpuset cgroups, where it belongs. This makes it possible to attach PF_NO_SETAFFINITY to Intel CAT cgroups.
Reported-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index f89d929..0603652 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -2466,16 +2466,6 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf, if (threadgroup) tsk = tsk->group_leader; - /* - * Workqueue threads may acquire PF_NO_SETAFFINITY and become - * trapped in a cpuset, or RT worker may be born in a cgroup - * with no rt_runtime allocated. Just say no. - */ - if (tsk == kthreadd_task || (tsk->flags & PF_NO_SETAFFINITY)) { - ret = -EINVAL; - goto out_unlock_rcu; - } - get_task_struct(tsk); rcu_read_unlock(); diff --git a/kernel/cpuset.c b/kernel/cpuset.c index f0acff0..9fff4d6 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -53,6 +53,7 @@ #include <linux/time.h> #include <linux/backing-dev.h> #include <linux/sort.h> +#include <linux/kthread.h> #include <asm/uaccess.h> #include <linux/atomic.h> @@ -1445,6 +1446,17 @@ static int cpuset_can_attach(struct cgroup_subsys_state *css, goto out_unlock; cgroup_taskset_for_each(task, tset) { + /* + * Workqueue threads may acquire PF_NO_SETAFFINITY and become + * trapped in a cpuset, or RT worker may be born in a cgroup + * with no rt_runtime allocated. Just say no. + */ + if (task == kthreadd_task || + (task->flags & PF_NO_SETAFFINITY)) { + ret = -EINVAL; + goto out_unlock; + } + ret = task_can_attach(task, cs->cpus_allowed); if (ret) goto out_unlock;
| |