diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-12 21:12:21 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-12-12 21:12:21 -0500 |
commit | bb9d97b6dffa10cec5e1ce9adbce60f3c2b5eabc (patch) | |
tree | fb8351518fcfb91927e9e138f48284c44553f011 /kernel/cgroup_freezer.c | |
parent | 2f7ee5691eecb67c8108b92001a85563ea336ac5 (diff) |
cgroup: don't use subsys->can_attach_task() or ->attach_task()
Now that subsys->can_attach() and attach() take @tset instead of
@task, they can handle per-task operations. Convert
->can_attach_task() and ->attach_task() users to use ->can_attach()
and attach() instead. Most converions are straight-forward.
Noteworthy changes are,
* In cgroup_freezer, remove unnecessary NULL assignments to unused
methods. It's useless and very prone to get out of sync, which
already happened.
* In cpuset, PF_THREAD_BOUND test is checked for each task. This
doesn't make any practical difference but is conceptually cleaner.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Paul Menage <paul@paulmenage.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: James Morris <jmorris@namei.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'kernel/cgroup_freezer.c')
-rw-r--r-- | kernel/cgroup_freezer.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index e95c6fb65cc0..0e748059ba87 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -162,10 +162,14 @@ static int freezer_can_attach(struct cgroup_subsys *ss, | |||
162 | struct cgroup_taskset *tset) | 162 | struct cgroup_taskset *tset) |
163 | { | 163 | { |
164 | struct freezer *freezer; | 164 | struct freezer *freezer; |
165 | struct task_struct *task; | ||
165 | 166 | ||
166 | /* | 167 | /* |
167 | * Anything frozen can't move or be moved to/from. | 168 | * Anything frozen can't move or be moved to/from. |
168 | */ | 169 | */ |
170 | cgroup_taskset_for_each(task, new_cgroup, tset) | ||
171 | if (cgroup_freezing(task)) | ||
172 | return -EBUSY; | ||
169 | 173 | ||
170 | freezer = cgroup_freezer(new_cgroup); | 174 | freezer = cgroup_freezer(new_cgroup); |
171 | if (freezer->state != CGROUP_THAWED) | 175 | if (freezer->state != CGROUP_THAWED) |
@@ -174,11 +178,6 @@ static int freezer_can_attach(struct cgroup_subsys *ss, | |||
174 | return 0; | 178 | return 0; |
175 | } | 179 | } |
176 | 180 | ||
177 | static int freezer_can_attach_task(struct cgroup *cgrp, struct task_struct *tsk) | ||
178 | { | ||
179 | return cgroup_freezing(tsk) ? -EBUSY : 0; | ||
180 | } | ||
181 | |||
182 | static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task) | 181 | static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task) |
183 | { | 182 | { |
184 | struct freezer *freezer; | 183 | struct freezer *freezer; |
@@ -374,10 +373,5 @@ struct cgroup_subsys freezer_subsys = { | |||
374 | .populate = freezer_populate, | 373 | .populate = freezer_populate, |
375 | .subsys_id = freezer_subsys_id, | 374 | .subsys_id = freezer_subsys_id, |
376 | .can_attach = freezer_can_attach, | 375 | .can_attach = freezer_can_attach, |
377 | .can_attach_task = freezer_can_attach_task, | ||
378 | .pre_attach = NULL, | ||
379 | .attach_task = NULL, | ||
380 | .attach = NULL, | ||
381 | .fork = freezer_fork, | 376 | .fork = freezer_fork, |
382 | .exit = NULL, | ||
383 | }; | 377 | }; |