On Thu 01-08-13 17:49:53, Tejun Heo wrote:
> 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
> Cc: Li Zefan
> Cc: Johannes Weiner
> Cc: Michal Hocko
> Cc: Balbir Singh
> Cc: Aristeu Rozanski
> Cc: Matt Helsley
> Cc: Vivek Goyal
> Cc: Jens Axboe
For memcg part
Acked-by: Michal Hocko
(I hated additional css.cgroup step anyway)
> ---
> block/blk-cgroup.c | 8 +--
> block/blk-cgroup.h | 25 -
> block/blk-throttle.c | 8 +--
> include/linux/cgroup.h | 88 ---
> kernel/cgroup.c | 131
> ++-
> kernel/cgroup_freezer.c | 25 -
> kernel/cpuset.c | 58 ++---
> mm/memcontrol.c | 20
> security/device_cgroup.c | 11 ++--
> 9 files changed, 187 insertions(+), 187 deletions(-)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index f46f3c6..4b40640 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -614,7 +614,7 @@ u64 blkg_stat_recursive_sum(struct blkg_policy_data *pd,
> int off)
> {
> struct blkcg_policy *pol = blkcg_policy[pd->plid];
> struct blkcg_gq *pos_blkg;
> - struct cgroup *pos_cgrp;
> + struct cgroup_subsys_state *pos_css;
> u64 sum;
>
> lockdep_assert_held(pd->blkg->q->queue_lock);
> @@ -622,7 +622,7 @@ u64 blkg_stat_recursive_sum(struct blkg_policy_data *pd,
> int off)
> sum = blkg_stat_read((void *)pd + off);
>
> rcu_read_lock();
> - blkg_for_each_descendant_pre(pos_blkg, pos_cgrp, pd_to_blkg(pd)) {
> + blkg_for_each_descendant_pre(pos_blkg, pos_css, pd_to_blkg(pd)) {
> struct blkg_policy_data *pos_pd = blkg_to_pd(pos_blkg, pol);
> struct blkg_stat *stat = (void *)pos_pd + off;
>
> @@ -649,7 +649,7 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct
> blkg_policy_data *pd,
> {
> struct blkcg_policy *pol = blkcg_policy[pd->plid];
> struct blkcg_gq *pos_blkg;
> - struct cgroup *pos_cgrp;
> + struct cgroup_subsys_state *pos_css;
> struct blkg_rwstat sum;
> int i;
>
> @@ -658,7 +658,7 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct
> blkg_policy_data *pd,
> sum = blkg_rwstat_read((void *)pd + off);
>
> rcu_read_lock();
> - blkg_for_each_descendant_pre(pos_blkg, pos_cgrp, pd_to_blkg(pd)) {
> + blkg_for_each_descendant_pre(pos_blkg, pos_css, pd_to_blkg(pd)) {
> struct blkg_policy_data *pos_pd = blkg_to_pd(pos_blkg, pol);
> struct blkg_rwstat *rwstat = (void *)pos_pd + off;
> struct blkg_rwstat tmp;
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index b6802c4..8555386 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)
> return css ? container_of(css, struct blkcg, css) : NULL;
> }
>
> -static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup)
> -{
> - return css_to_blkcg(cgroup_css(cgroup, blkio_subsys_id));
> -}
> -
> static inline struct blkcg *task_blkcg(struct task_struct *tsk)
> {
> 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,
> /**
> * blkg_for_each_descendant_pre - pre-order walk of a blkg's descendants
> * @d_blkg: loop cursor pointing to the current descendant
> - * @pos_cgrp: used for iteration
> + * @pos_css: used for iteration
> * @p_blkg: target blkg to walk descendants of
> *
> * Walk @c_blkg through the descendants of @p_blkg. Must be used with RCU
> * read locked. If called under either blkcg or queue lock, the iteration
> * is guaranteed to include all and only online blkgs. The caller may
> - * update @pos_cgrp by calling cgroup_r