diff options
-rw-r--r-- | block/blk-cgroup.h | 12 | ||||
-rw-r--r-- | kernel/cgroup_freezer.c | 11 | ||||
-rw-r--r-- | kernel/cpuset.c | 11 | ||||
-rw-r--r-- | kernel/sched/core.c | 8 | ||||
-rw-r--r-- | kernel/sched/cpuacct.c | 11 | ||||
-rw-r--r-- | mm/hugetlb_cgroup.c | 2 | ||||
-rw-r--r-- | mm/memcontrol.c | 2 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 11 | ||||
-rw-r--r-- | security/device_cgroup.c | 2 |
9 files changed, 45 insertions, 25 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 628e50f6f8a8..8e5863e900bf 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -179,21 +179,25 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, | |||
179 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); | 179 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); |
180 | 180 | ||
181 | 181 | ||
182 | static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css) | ||
183 | { | ||
184 | return css ? container_of(css, struct blkcg, css) : NULL; | ||
185 | } | ||
186 | |||
182 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) | 187 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) |
183 | { | 188 | { |
184 | return container_of(cgroup_css(cgroup, blkio_subsys_id), | 189 | return css_to_blkcg(cgroup_css(cgroup, blkio_subsys_id)); |
185 | struct blkcg, css); | ||
186 | } | 190 | } |
187 | 191 | ||
188 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) | 192 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) |
189 | { | 193 | { |
190 | return container_of(task_css(tsk, blkio_subsys_id), struct blkcg, css); | 194 | return css_to_blkcg(task_css(tsk, blkio_subsys_id)); |
191 | } | 195 | } |
192 | 196 | ||
193 | static inline struct blkcg *bio_blkcg(struct bio *bio) | 197 | static inline struct blkcg *bio_blkcg(struct bio *bio) |
194 | { | 198 | { |
195 | if (bio && bio->bi_css) | 199 | if (bio && bio->bi_css) |
196 | return container_of(bio->bi_css, struct blkcg, css); | 200 | return css_to_blkcg(bio->bi_css); |
197 | return task_blkcg(current); | 201 | return task_blkcg(current); |
198 | } | 202 | } |
199 | 203 | ||
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 9d3f61566fec..1db686e47a22 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -45,16 +45,19 @@ struct freezer { | |||
45 | spinlock_t lock; | 45 | spinlock_t lock; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static inline struct freezer *css_freezer(struct cgroup_subsys_state *css) | ||
49 | { | ||
50 | return css ? container_of(css, struct freezer, css) : NULL; | ||
51 | } | ||
52 | |||
48 | static inline struct freezer *cgroup_freezer(struct cgroup *cgroup) | 53 | static inline struct freezer *cgroup_freezer(struct cgroup *cgroup) |
49 | { | 54 | { |
50 | return container_of(cgroup_css(cgroup, freezer_subsys_id), | 55 | return css_freezer(cgroup_css(cgroup, freezer_subsys_id)); |
51 | struct freezer, css); | ||
52 | } | 56 | } |
53 | 57 | ||
54 | static inline struct freezer *task_freezer(struct task_struct *task) | 58 | static inline struct freezer *task_freezer(struct task_struct *task) |
55 | { | 59 | { |
56 | return container_of(task_css(task, freezer_subsys_id), | 60 | return css_freezer(task_css(task, freezer_subsys_id)); |
57 | struct freezer, css); | ||
58 | } | 61 | } |
59 | 62 | ||
60 | static struct freezer *parent_freezer(struct freezer *freezer) | 63 | static struct freezer *parent_freezer(struct freezer *freezer) |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index f7371341d42a..6e9cbdde25bd 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -114,18 +114,21 @@ struct cpuset { | |||
114 | int relax_domain_level; | 114 | int relax_domain_level; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static inline struct cpuset *css_cs(struct cgroup_subsys_state *css) | ||
118 | { | ||
119 | return css ? container_of(css, struct cpuset, css) : NULL; | ||
120 | } | ||
121 | |||
117 | /* Retrieve the cpuset for a cgroup */ | 122 | /* Retrieve the cpuset for a cgroup */ |
118 | static inline struct cpuset *cgroup_cs(struct cgroup *cgrp) | 123 | static inline struct cpuset *cgroup_cs(struct cgroup *cgrp) |
119 | { | 124 | { |
120 | return container_of(cgroup_css(cgrp, cpuset_subsys_id), | 125 | return css_cs(cgroup_css(cgrp, cpuset_subsys_id)); |
121 | struct cpuset, css); | ||
122 | } | 126 | } |
123 | 127 | ||
124 | /* Retrieve the cpuset for a task */ | 128 | /* Retrieve the cpuset for a task */ |
125 | static inline struct cpuset *task_cs(struct task_struct *task) | 129 | static inline struct cpuset *task_cs(struct task_struct *task) |
126 | { | 130 | { |
127 | return container_of(task_css(task, cpuset_subsys_id), | 131 | return css_cs(task_css(task, cpuset_subsys_id)); |
128 | struct cpuset, css); | ||
129 | } | 132 | } |
130 | 133 | ||
131 | static inline struct cpuset *parent_cs(struct cpuset *cs) | 134 | static inline struct cpuset *parent_cs(struct cpuset *cs) |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 323d907eac1a..5bccb0277129 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -7083,11 +7083,15 @@ int sched_rt_handler(struct ctl_table *table, int write, | |||
7083 | 7083 | ||
7084 | #ifdef CONFIG_CGROUP_SCHED | 7084 | #ifdef CONFIG_CGROUP_SCHED |
7085 | 7085 | ||
7086 | static inline struct task_group *css_tg(struct cgroup_subsys_state *css) | ||
7087 | { | ||
7088 | return css ? container_of(css, struct task_group, css) : NULL; | ||
7089 | } | ||
7090 | |||
7086 | /* return corresponding task_group object of a cgroup */ | 7091 | /* return corresponding task_group object of a cgroup */ |
7087 | static inline struct task_group *cgroup_tg(struct cgroup *cgrp) | 7092 | static inline struct task_group *cgroup_tg(struct cgroup *cgrp) |
7088 | { | 7093 | { |
7089 | return container_of(cgroup_css(cgrp, cpu_cgroup_subsys_id), | 7094 | return css_tg(cgroup_css(cgrp, cpu_cgroup_subsys_id)); |
7090 | struct task_group, css); | ||
7091 | } | 7095 | } |
7092 | 7096 | ||
7093 | static struct cgroup_subsys_state *cpu_cgroup_css_alloc(struct cgroup *cgrp) | 7097 | static struct cgroup_subsys_state *cpu_cgroup_css_alloc(struct cgroup *cgrp) |
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 4a210faaab77..8ccfa10cc89f 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
@@ -33,18 +33,21 @@ struct cpuacct { | |||
33 | struct kernel_cpustat __percpu *cpustat; | 33 | struct kernel_cpustat __percpu *cpustat; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static inline struct cpuacct *css_ca(struct cgroup_subsys_state *css) | ||
37 | { | ||
38 | return css ? container_of(css, struct cpuacct, css) : NULL; | ||
39 | } | ||
40 | |||
36 | /* return cpu accounting group corresponding to this container */ | 41 | /* return cpu accounting group corresponding to this container */ |
37 | static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) | 42 | static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) |
38 | { | 43 | { |
39 | return container_of(cgroup_css(cgrp, cpuacct_subsys_id), | 44 | return css_ca(cgroup_css(cgrp, cpuacct_subsys_id)); |
40 | struct cpuacct, css); | ||
41 | } | 45 | } |
42 | 46 | ||
43 | /* return cpu accounting group to which this task belongs */ | 47 | /* return cpu accounting group to which this task belongs */ |
44 | static inline struct cpuacct *task_ca(struct task_struct *tsk) | 48 | static inline struct cpuacct *task_ca(struct task_struct *tsk) |
45 | { | 49 | { |
46 | return container_of(task_css(tsk, cpuacct_subsys_id), | 50 | return css_ca(task_css(tsk, cpuacct_subsys_id)); |
47 | struct cpuacct, css); | ||
48 | } | 51 | } |
49 | 52 | ||
50 | static inline struct cpuacct *__parent_ca(struct cpuacct *ca) | 53 | static inline struct cpuacct *__parent_ca(struct cpuacct *ca) |
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index d2f9fc0b186e..95585a0b9c8d 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
@@ -36,7 +36,7 @@ static struct hugetlb_cgroup *root_h_cgroup __read_mostly; | |||
36 | static inline | 36 | static inline |
37 | struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s) | 37 | struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s) |
38 | { | 38 | { |
39 | return container_of(s, struct hugetlb_cgroup, css); | 39 | return s ? container_of(s, struct hugetlb_cgroup, css) : NULL; |
40 | } | 40 | } |
41 | 41 | ||
42 | static inline | 42 | static inline |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b47bd3ad3c2b..11d659e3b08e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -486,7 +486,7 @@ static DEFINE_MUTEX(memcg_create_mutex); | |||
486 | static inline | 486 | static inline |
487 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) | 487 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) |
488 | { | 488 | { |
489 | return container_of(s, struct mem_cgroup, css); | 489 | return s ? container_of(s, struct mem_cgroup, css) : NULL; |
490 | } | 490 | } |
491 | 491 | ||
492 | /* Some nice accessors for the vmpressure. */ | 492 | /* Some nice accessors for the vmpressure. */ |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 5ee72a001df0..af412ab2b477 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -23,16 +23,19 @@ | |||
23 | #include <net/sock.h> | 23 | #include <net/sock.h> |
24 | #include <net/cls_cgroup.h> | 24 | #include <net/cls_cgroup.h> |
25 | 25 | ||
26 | static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css) | ||
27 | { | ||
28 | return css ? container_of(css, struct cgroup_cls_state, css) : NULL; | ||
29 | } | ||
30 | |||
26 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) | 31 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) |
27 | { | 32 | { |
28 | return container_of(cgroup_css(cgrp, net_cls_subsys_id), | 33 | return css_cls_state(cgroup_css(cgrp, net_cls_subsys_id)); |
29 | struct cgroup_cls_state, css); | ||
30 | } | 34 | } |
31 | 35 | ||
32 | static inline struct cgroup_cls_state *task_cls_state(struct task_struct *p) | 36 | static inline struct cgroup_cls_state *task_cls_state(struct task_struct *p) |
33 | { | 37 | { |
34 | return container_of(task_css(p, net_cls_subsys_id), | 38 | return css_cls_state(task_css(p, net_cls_subsys_id)); |
35 | struct cgroup_cls_state, css); | ||
36 | } | 39 | } |
37 | 40 | ||
38 | static struct cgroup_subsys_state *cgrp_css_alloc(struct cgroup *cgrp) | 41 | static struct cgroup_subsys_state *cgrp_css_alloc(struct cgroup *cgrp) |
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 87a0a037fbd6..90953648c643 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -53,7 +53,7 @@ struct dev_cgroup { | |||
53 | 53 | ||
54 | static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) | 54 | static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) |
55 | { | 55 | { |
56 | return container_of(s, struct dev_cgroup, css); | 56 | return s ? container_of(s, struct dev_cgroup, css) : NULL; |
57 | } | 57 | } |
58 | 58 | ||
59 | static inline struct dev_cgroup *cgroup_to_devcgroup(struct cgroup *cgroup) | 59 | static inline struct dev_cgroup *cgroup_to_devcgroup(struct cgroup *cgroup) |