summaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-08 20:11:25 -0400
committerTejun Heo <tj@kernel.org>2013-08-08 20:11:25 -0400
commit492eb21b98f88e411a8bb43d6edcd7d7022add10 (patch)
treeda06df9485fd607762fdec06169f7d9f601e3cf6 /block/blk-cgroup.h
parentf48e3924dca268c677c4e338e5d91ad9e6fe6b9e (diff)
cgroup: make hierarchy iterators deal with cgroup_subsys_state instead of cgroup
cgroup is currently in the process of transitioning to using css (cgroup_subsys_state) as the primary handle instead of cgroup in subsystem API. For hierarchy iterators, this is beneficial because * In most cases, css is the only thing subsystems care about anyway. * On the planned unified hierarchy, iterations for different subsystems will need to skip over different subtrees of the hierarchy depending on which subsystems are enabled on each cgroup. Passing around css makes it unnecessary to explicitly specify the subsystem in question as css is intersection between cgroup and subsystem * For the planned unified hierarchy, css's would need to be created and destroyed dynamically independent from cgroup hierarchy. Having cgroup core manage css iteration makes enforcing deref rules a lot easier. Most subsystem conversions are straight-forward. Noteworthy changes are * blkio: cgroup_to_blkcg() is no longer used. Removed. * freezer: cgroup_freezer() is no longer used. Removed. * devices: cgroup_to_devcgroup() is no longer used. Removed. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Aristeu Rozanski <aris@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com> Cc: Matt Helsley <matthltc@us.ibm.com> Cc: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h25
1 files changed, 9 insertions, 16 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index b6802c46d68f..855538630300 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -184,11 +184,6 @@ static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css)
184 return css ? container_of(css, struct blkcg, css) : NULL; 184 return css ? container_of(css, struct blkcg, css) : NULL;
185} 185}
186 186
187static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup)
188{
189 return css_to_blkcg(cgroup_css(cgroup, blkio_subsys_id));
190}
191
192static inline struct blkcg *task_blkcg(struct task_struct *tsk) 187static inline struct blkcg *task_blkcg(struct task_struct *tsk)
193{ 188{
194 return css_to_blkcg(task_css(tsk, blkio_subsys_id)); 189 return css_to_blkcg(task_css(tsk, blkio_subsys_id));
@@ -289,32 +284,31 @@ struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, struct request_queue *q,
289/** 284/**
290 * blkg_for_each_descendant_pre - pre-order walk of a blkg's descendants 285 * blkg_for_each_descendant_pre - pre-order walk of a blkg's descendants
291 * @d_blkg: loop cursor pointing to the current descendant 286 * @d_blkg: loop cursor pointing to the current descendant
292 * @pos_cgrp: used for iteration 287 * @pos_css: used for iteration
293 * @p_blkg: target blkg to walk descendants of 288 * @p_blkg: target blkg to walk descendants of
294 * 289 *
295 * Walk @c_blkg through the descendants of @p_blkg. Must be used with RCU 290 * Walk @c_blkg through the descendants of @p_blkg. Must be used with RCU
296 * read locked. If called under either blkcg or queue lock, the iteration 291 * read locked. If called under either blkcg or queue lock, the iteration
297 * is guaranteed to include all and only online blkgs. The caller may 292 * is guaranteed to include all and only online blkgs. The caller may
298 * update @pos_cgrp by calling cgroup_rightmost_descendant() to skip 293 * update @pos_css by calling css_rightmost_descendant() to skip subtree.
299 * subtree.
300 */ 294 */
301#define blkg_for_each_descendant_pre(d_blkg, pos_cgrp, p_blkg) \ 295#define blkg_for_each_descendant_pre(d_blkg, pos_css, p_blkg) \
302 cgroup_for_each_descendant_pre((pos_cgrp), (p_blkg)->blkcg->css.cgroup) \ 296 css_for_each_descendant_pre((pos_css), &(p_blkg)->blkcg->css) \
303 if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \ 297 if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \
304 (p_blkg)->q, false))) 298 (p_blkg)->q, false)))
305 299
306/** 300/**
307 * blkg_for_each_descendant_post - post-order walk of a blkg's descendants 301 * blkg_for_each_descendant_post - post-order walk of a blkg's descendants
308 * @d_blkg: loop cursor pointing to the current descendant 302 * @d_blkg: loop cursor pointing to the current descendant
309 * @pos_cgrp: used for iteration 303 * @pos_css: used for iteration
310 * @p_blkg: target blkg to walk descendants of 304 * @p_blkg: target blkg to walk descendants of
311 * 305 *
312 * Similar to blkg_for_each_descendant_pre() but performs post-order 306 * Similar to blkg_for_each_descendant_pre() but performs post-order
313 * traversal instead. Synchronization rules are the same. 307 * traversal instead. Synchronization rules are the same.
314 */ 308 */
315#define blkg_for_each_descendant_post(d_blkg, pos_cgrp, p_blkg) \ 309#define blkg_for_each_descendant_post(d_blkg, pos_css, p_blkg) \
316 cgroup_for_each_descendant_post((pos_cgrp), (p_blkg)->blkcg->css.cgroup) \ 310 css_for_each_descendant_post((pos_css), &(p_blkg)->blkcg->css) \
317 if (((d_blkg) = __blkg_lookup(cgroup_to_blkcg(pos_cgrp), \ 311 if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \
318 (p_blkg)->q, false))) 312 (p_blkg)->q, false)))
319 313
320/** 314/**
@@ -577,7 +571,6 @@ static inline int blkcg_activate_policy(struct request_queue *q,
577static inline void blkcg_deactivate_policy(struct request_queue *q, 571static inline void blkcg_deactivate_policy(struct request_queue *q,
578 const struct blkcg_policy *pol) { } 572 const struct blkcg_policy *pol) { }
579 573
580static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) { return NULL; }
581static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } 574static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; }
582 575
583static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg, 576static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg,