Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278474

[PATCH] cgroups: move cpuset specific checks from generic code to cpuset_can_attach (v2)

From Marcelo Tosatti <mtosatti@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] cgroups: move cpuset specific checks from generic code to cpuset_can_attach (v2)
Date 2015-11-26 23:40 +0100
Message-ID <qzdmO-2Nc-25@gated-at.bofh.it> (permalink)
References <qyQqe-3L8-17@gated-at.bofh.it> <qz3x8-4VN-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Move PF_NO_SETAFFINITY and kthreadd_task checks to cpuset cgroups,  
where they belong. This makes it possible to attach PF_NO_SETAFFINITY 
tasks to Intel CAT cgroup.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Chao Peng <chao.p.peng@linux.intel.com>

v2: "PF_NO_SETAFFINITY check" -> "PF_NO_SETAFFINITY and kthreadd_task
checks"

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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] cgroups: move cpuset specific checks from generic code to  cpuset_can_attach Marcelo Tosatti <mtosatti@redhat.com> - 2015-11-25 23:10 +0100
  Re: [PATCH] cgroups: move cpuset specific checks from generic code  to cpuset_can_attach Chao Peng <chao.p.peng@linux.intel.com> - 2015-11-26 09:10 +0100
  Re: [PATCH] cgroups: move cpuset specific checks from generic code  to cpuset_can_attach Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-11-26 13:10 +0100
    [PATCH] cgroups: move cpuset specific checks from generic code to  cpuset_can_attach (v2) Marcelo Tosatti <mtosatti@redhat.com> - 2015-11-26 23:40 +0100
      Re: [PATCH] cgroups: move cpuset specific checks from generic code  to cpuset_can_attach (v2) Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-11-27 00:50 +0100

csiph-web