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:
Tejun Heo
2014-05-16 13:22:48 -04:00
parent 3b514d24e2
commit 5c9d535b89
12 changed files with 34 additions and 41 deletions

View File

@@ -48,22 +48,28 @@ enum cgroup_subsys_id {
};
#undef SUBSYS
/* Per-subsystem/per-cgroup state maintained by the system. */
/*
* Per-subsystem/per-cgroup state maintained by the system. This is the
* fundamental structural building block that controllers deal with.
*
* Fields marked with "PI:" are public and immutable and may be accessed
* directly without synchronization.
*/
struct cgroup_subsys_state {
/* the cgroup that this css is attached to */
/* PI: the cgroup that this css is attached to */
struct cgroup *cgroup;
/* the cgroup subsystem that this css is attached to */
/* PI: the cgroup subsystem that this css is attached to */
struct cgroup_subsys *ss;
/* reference count - access via css_[try]get() and css_put() */
struct percpu_ref refcnt;
/* the parent css */
/* PI: the parent css */
struct cgroup_subsys_state *parent;
/*
* Subsys-unique ID. 0 is unused and root is always 1. The
* PI: Subsys-unique ID. 0 is unused and root is always 1. The
* matching css can be looked up using css_from_id().
*/
int id;
@@ -669,19 +675,6 @@ struct cgroup_subsys {
#include <linux/cgroup_subsys.h>
#undef SUBSYS
/**
* css_parent - find the parent css
* @css: the target cgroup_subsys_state
*
* Return the parent css of @css. This function is guaranteed to return
* non-NULL parent as long as @css isn't the root.
*/
static inline
struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
{
return css->parent;
}
/**
* task_css_set_check - obtain a task's css_set with extra access conditions
* @task: the task to obtain css_set for