cgroup: remove css_parent()
cgroup in general is moving towards using cgroup_subsys_state as the fundamental structural component and css_parent() was introduced to convert from using cgroup->parent to css->parent. It was quite some time ago and we're moving forward with making css more prominent. This patch drops the trivial wrapper css_parent() and let the users dereference css->parent. While at it, explicitly mark fields of css which are public and immutable. v2: New usage from device_cgroup.c converted. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: "David S. Miller" <davem@davemloft.net> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Johannes Weiner <hannes@cmpxchg.org>
This commit is contained in:
@@ -3176,10 +3176,10 @@ css_next_descendant_pre(struct cgroup_subsys_state *pos,
|
||||
|
||||
/* no child, visit my or the closest ancestor's next sibling */
|
||||
while (pos != root) {
|
||||
next = css_next_child(pos, css_parent(pos));
|
||||
next = css_next_child(pos, pos->parent);
|
||||
if (next)
|
||||
return next;
|
||||
pos = css_parent(pos);
|
||||
pos = pos->parent;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -3261,12 +3261,12 @@ css_next_descendant_post(struct cgroup_subsys_state *pos,
|
||||
return NULL;
|
||||
|
||||
/* if there's an unvisited sibling, visit its leftmost descendant */
|
||||
next = css_next_child(pos, css_parent(pos));
|
||||
next = css_next_child(pos, pos->parent);
|
||||
if (next)
|
||||
return css_leftmost_descendant(next);
|
||||
|
||||
/* no sibling left, visit parent */
|
||||
return css_parent(pos);
|
||||
return pos->parent;
|
||||
}
|
||||
|
||||
static bool cgroup_has_live_children(struct cgroup *cgrp)
|
||||
|
@@ -59,7 +59,7 @@ static inline struct freezer *task_freezer(struct task_struct *task)
|
||||
|
||||
static struct freezer *parent_freezer(struct freezer *freezer)
|
||||
{
|
||||
return css_freezer(css_parent(&freezer->css));
|
||||
return css_freezer(freezer->css.parent);
|
||||
}
|
||||
|
||||
bool cgroup_freezing(struct task_struct *task)
|
||||
|
@@ -124,7 +124,7 @@ static inline struct cpuset *task_cs(struct task_struct *task)
|
||||
|
||||
static inline struct cpuset *parent_cs(struct cpuset *cs)
|
||||
{
|
||||
return css_cs(css_parent(&cs->css));
|
||||
return css_cs(cs->css.parent);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
|
@@ -7586,7 +7586,7 @@ cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
|
||||
static int cpu_cgroup_css_online(struct cgroup_subsys_state *css)
|
||||
{
|
||||
struct task_group *tg = css_tg(css);
|
||||
struct task_group *parent = css_tg(css_parent(css));
|
||||
struct task_group *parent = css_tg(css->parent);
|
||||
|
||||
if (parent)
|
||||
sched_online_group(tg, parent);
|
||||
|
@@ -46,7 +46,7 @@ static inline struct cpuacct *task_ca(struct task_struct *tsk)
|
||||
|
||||
static inline struct cpuacct *parent_ca(struct cpuacct *ca)
|
||||
{
|
||||
return css_ca(css_parent(&ca->css));
|
||||
return css_ca(ca->css.parent);
|
||||
}
|
||||
|
||||
static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage);
|
||||
|
Reference in New Issue
Block a user