aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-08 20:11:27 -0400
committerTejun Heo <tj@kernel.org>2013-08-08 20:11:27 -0400
commitd99c8727e7bbc01b70e2c57e6127bfab26b868fd (patch)
tree9479ba1329ac1184cf82755ade7dfe94e9d7a4be /kernel/cpuset.c
parent81eeaf0411204f52af8ef78ff107cfca2fcfec1d (diff)
cgroup: make cgroup_taskset deal with cgroup_subsys_state instead of cgroup
cgroup is in the process of converting to css (cgroup_subsys_state) from cgroup as the principal subsystem interface handle. This is mostly to prepare for the unified hierarchy support where css's will be created and destroyed dynamically but also helps cleaning up subsystem implementations as css is usually what they are interested in anyway. cgroup_taskset which is used by the subsystem attach methods is the last cgroup subsystem API which isn't using css as the handle. Update cgroup_taskset_cur_cgroup() to cgroup_taskset_cur_css() and cgroup_taskset_for_each() to take @skip_css instead of @skip_cgrp. The conversions are pretty mechanical. One exception is cpuset::cgroup_cs(), which lost its last user and got removed. This patch shouldn't introduce any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Matt Helsley <matthltc@us.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 39e52175f4af..bf69717325b4 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -119,12 +119,6 @@ static inline struct cpuset *css_cs(struct cgroup_subsys_state *css)
119 return css ? container_of(css, struct cpuset, css) : NULL; 119 return css ? container_of(css, struct cpuset, css) : NULL;
120} 120}
121 121
122/* Retrieve the cpuset for a cgroup */
123static inline struct cpuset *cgroup_cs(struct cgroup *cgrp)
124{
125 return css_cs(cgroup_css(cgrp, cpuset_subsys_id));
126}
127
128/* Retrieve the cpuset for a task */ 122/* Retrieve the cpuset for a task */
129static inline struct cpuset *task_cs(struct task_struct *task) 123static inline struct cpuset *task_cs(struct task_struct *task)
130{ 124{
@@ -1459,7 +1453,7 @@ static int cpuset_can_attach(struct cgroup_subsys_state *css,
1459 (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))) 1453 (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)))
1460 goto out_unlock; 1454 goto out_unlock;
1461 1455
1462 cgroup_taskset_for_each(task, css->cgroup, tset) { 1456 cgroup_taskset_for_each(task, css, tset) {
1463 /* 1457 /*
1464 * Kthreads which disallow setaffinity shouldn't be moved 1458 * Kthreads which disallow setaffinity shouldn't be moved
1465 * to a new cpuset; we don't want to change their cpu 1459 * to a new cpuset; we don't want to change their cpu
@@ -1511,9 +1505,10 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
1511 struct mm_struct *mm; 1505 struct mm_struct *mm;
1512 struct task_struct *task; 1506 struct task_struct *task;
1513 struct task_struct *leader = cgroup_taskset_first(tset); 1507 struct task_struct *leader = cgroup_taskset_first(tset);
1514 struct cgroup *oldcgrp = cgroup_taskset_cur_cgroup(tset); 1508 struct cgroup_subsys_state *oldcss = cgroup_taskset_cur_css(tset,
1509 cpuset_subsys_id);
1515 struct cpuset *cs = css_cs(css); 1510 struct cpuset *cs = css_cs(css);
1516 struct cpuset *oldcs = cgroup_cs(oldcgrp); 1511 struct cpuset *oldcs = css_cs(oldcss);
1517 struct cpuset *cpus_cs = effective_cpumask_cpuset(cs); 1512 struct cpuset *cpus_cs = effective_cpumask_cpuset(cs);
1518 struct cpuset *mems_cs = effective_nodemask_cpuset(cs); 1513 struct cpuset *mems_cs = effective_nodemask_cpuset(cs);
1519 1514
@@ -1527,7 +1522,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
1527 1522
1528 guarantee_online_mems(mems_cs, &cpuset_attach_nodemask_to); 1523 guarantee_online_mems(mems_cs, &cpuset_attach_nodemask_to);
1529 1524
1530 cgroup_taskset_for_each(task, css->cgroup, tset) { 1525 cgroup_taskset_for_each(task, css, tset) {
1531 /* 1526 /*
1532 * can_attach beforehand should guarantee that this doesn't 1527 * can_attach beforehand should guarantee that this doesn't
1533 * fail. TODO: have a better way to handle failure here 1528 * fail. TODO: have a better way to handle failure here