diff options
author | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
commit | 182446d087906de40e514573a92a97b203695f71 (patch) | |
tree | 6aee96219c82d0a64b9d389c50666c1ce0ec27ee /mm | |
parent | 67f4c36f83455b253445b2cb28ac9a2c4f85d99a (diff) |
cgroup: pass around cgroup_subsys_state instead of cgroup in file methods
cgroup is currently in the process of transitioning to using struct
cgroup_subsys_state * as the primary handle instead of struct cgroup.
Please see the previous commit which converts the subsystem methods
for rationale.
This patch converts all cftype file operations to take @css instead of
@cgroup. cftypes for the cgroup core files don't have their subsytem
pointer set. These will automatically use the dummy_css added by the
previous patch and can be converted the same way.
Most subsystem conversions are straight forwards but there are some
interesting ones.
* freezer: update_if_frozen() is also converted to take @css instead
of @cgroup for consistency. This will make the code look simpler
too once iterators are converted to use css.
* memory/vmpressure: mem_cgroup_from_css() needs to be exported to
vmpressure while mem_cgroup_from_cont() can be made static.
Updated accordingly.
* cpu: cgroup_tg() doesn't have any user left. Removed.
* cpuacct: cgroup_ca() doesn't have any user left. Removed.
* hugetlb: hugetlb_cgroup_form_cgroup() doesn't have any user left.
Removed.
* net_cls: cgrp_cls_state() doesn't have any user left. 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>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@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>
Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb_cgroup.c | 26 | ||||
-rw-r--r-- | mm/memcontrol.c | 88 | ||||
-rw-r--r-- | mm/vmpressure.c | 4 |
3 files changed, 58 insertions, 60 deletions
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index e2132435060f..bda8e44f6fde 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
@@ -40,12 +40,6 @@ struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | static inline | 42 | static inline |
43 | struct hugetlb_cgroup *hugetlb_cgroup_from_cgroup(struct cgroup *cgroup) | ||
44 | { | ||
45 | return hugetlb_cgroup_from_css(cgroup_css(cgroup, hugetlb_subsys_id)); | ||
46 | } | ||
47 | |||
48 | static inline | ||
49 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) | 43 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) |
50 | { | 44 | { |
51 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_subsys_id)); | 45 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_subsys_id)); |
@@ -248,14 +242,15 @@ void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, | |||
248 | return; | 242 | return; |
249 | } | 243 | } |
250 | 244 | ||
251 | static ssize_t hugetlb_cgroup_read(struct cgroup *cgroup, struct cftype *cft, | 245 | static ssize_t hugetlb_cgroup_read(struct cgroup_subsys_state *css, |
252 | struct file *file, char __user *buf, | 246 | struct cftype *cft, struct file *file, |
253 | size_t nbytes, loff_t *ppos) | 247 | char __user *buf, size_t nbytes, |
248 | loff_t *ppos) | ||
254 | { | 249 | { |
255 | u64 val; | 250 | u64 val; |
256 | char str[64]; | 251 | char str[64]; |
257 | int idx, name, len; | 252 | int idx, name, len; |
258 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 253 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
259 | 254 | ||
260 | idx = MEMFILE_IDX(cft->private); | 255 | idx = MEMFILE_IDX(cft->private); |
261 | name = MEMFILE_ATTR(cft->private); | 256 | name = MEMFILE_ATTR(cft->private); |
@@ -265,12 +260,12 @@ static ssize_t hugetlb_cgroup_read(struct cgroup *cgroup, struct cftype *cft, | |||
265 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); | 260 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); |
266 | } | 261 | } |
267 | 262 | ||
268 | static int hugetlb_cgroup_write(struct cgroup *cgroup, struct cftype *cft, | 263 | static int hugetlb_cgroup_write(struct cgroup_subsys_state *css, |
269 | const char *buffer) | 264 | struct cftype *cft, const char *buffer) |
270 | { | 265 | { |
271 | int idx, name, ret; | 266 | int idx, name, ret; |
272 | unsigned long long val; | 267 | unsigned long long val; |
273 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 268 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
274 | 269 | ||
275 | idx = MEMFILE_IDX(cft->private); | 270 | idx = MEMFILE_IDX(cft->private); |
276 | name = MEMFILE_ATTR(cft->private); | 271 | name = MEMFILE_ATTR(cft->private); |
@@ -295,10 +290,11 @@ static int hugetlb_cgroup_write(struct cgroup *cgroup, struct cftype *cft, | |||
295 | return ret; | 290 | return ret; |
296 | } | 291 | } |
297 | 292 | ||
298 | static int hugetlb_cgroup_reset(struct cgroup *cgroup, unsigned int event) | 293 | static int hugetlb_cgroup_reset(struct cgroup_subsys_state *css, |
294 | unsigned int event) | ||
299 | { | 295 | { |
300 | int idx, name, ret = 0; | 296 | int idx, name, ret = 0; |
301 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 297 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
302 | 298 | ||
303 | idx = MEMFILE_IDX(event); | 299 | idx = MEMFILE_IDX(event); |
304 | name = MEMFILE_ATTR(event); | 300 | name = MEMFILE_ATTR(event); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 32cca0f0af0d..ab64dfc84f8c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -483,7 +483,6 @@ enum res_type { | |||
483 | */ | 483 | */ |
484 | static DEFINE_MUTEX(memcg_create_mutex); | 484 | static DEFINE_MUTEX(memcg_create_mutex); |
485 | 485 | ||
486 | static inline | ||
487 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) | 486 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) |
488 | { | 487 | { |
489 | return s ? container_of(s, struct mem_cgroup, css) : NULL; | 488 | return s ? container_of(s, struct mem_cgroup, css) : NULL; |
@@ -1035,7 +1034,7 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page) | |||
1035 | preempt_enable(); | 1034 | preempt_enable(); |
1036 | } | 1035 | } |
1037 | 1036 | ||
1038 | struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont) | 1037 | static inline struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont) |
1039 | { | 1038 | { |
1040 | return mem_cgroup_from_css(cgroup_css(cont, mem_cgroup_subsys_id)); | 1039 | return mem_cgroup_from_css(cgroup_css(cont, mem_cgroup_subsys_id)); |
1041 | } | 1040 | } |
@@ -2951,10 +2950,10 @@ static struct kmem_cache *memcg_params_to_cache(struct memcg_cache_params *p) | |||
2951 | } | 2950 | } |
2952 | 2951 | ||
2953 | #ifdef CONFIG_SLABINFO | 2952 | #ifdef CONFIG_SLABINFO |
2954 | static int mem_cgroup_slabinfo_read(struct cgroup *cont, struct cftype *cft, | 2953 | static int mem_cgroup_slabinfo_read(struct cgroup_subsys_state *css, |
2955 | struct seq_file *m) | 2954 | struct cftype *cft, struct seq_file *m) |
2956 | { | 2955 | { |
2957 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 2956 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
2958 | struct memcg_cache_params *params; | 2957 | struct memcg_cache_params *params; |
2959 | 2958 | ||
2960 | if (!memcg_can_account_kmem(memcg)) | 2959 | if (!memcg_can_account_kmem(memcg)) |
@@ -4999,9 +4998,10 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg) | |||
4999 | return 0; | 4998 | return 0; |
5000 | } | 4999 | } |
5001 | 5000 | ||
5002 | static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) | 5001 | static int mem_cgroup_force_empty_write(struct cgroup_subsys_state *css, |
5002 | unsigned int event) | ||
5003 | { | 5003 | { |
5004 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5004 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5005 | int ret; | 5005 | int ret; |
5006 | 5006 | ||
5007 | if (mem_cgroup_is_root(memcg)) | 5007 | if (mem_cgroup_is_root(memcg)) |
@@ -5014,16 +5014,17 @@ static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) | |||
5014 | } | 5014 | } |
5015 | 5015 | ||
5016 | 5016 | ||
5017 | static u64 mem_cgroup_hierarchy_read(struct cgroup *cont, struct cftype *cft) | 5017 | static u64 mem_cgroup_hierarchy_read(struct cgroup_subsys_state *css, |
5018 | struct cftype *cft) | ||
5018 | { | 5019 | { |
5019 | return mem_cgroup_from_cont(cont)->use_hierarchy; | 5020 | return mem_cgroup_from_css(css)->use_hierarchy; |
5020 | } | 5021 | } |
5021 | 5022 | ||
5022 | static int mem_cgroup_hierarchy_write(struct cgroup *cont, struct cftype *cft, | 5023 | static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css, |
5023 | u64 val) | 5024 | struct cftype *cft, u64 val) |
5024 | { | 5025 | { |
5025 | int retval = 0; | 5026 | int retval = 0; |
5026 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5027 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5027 | struct mem_cgroup *parent_memcg = mem_cgroup_from_css(css_parent(&memcg->css)); | 5028 | struct mem_cgroup *parent_memcg = mem_cgroup_from_css(css_parent(&memcg->css)); |
5028 | 5029 | ||
5029 | mutex_lock(&memcg_create_mutex); | 5030 | mutex_lock(&memcg_create_mutex); |
@@ -5094,11 +5095,11 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap) | |||
5094 | return val << PAGE_SHIFT; | 5095 | return val << PAGE_SHIFT; |
5095 | } | 5096 | } |
5096 | 5097 | ||
5097 | static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft, | 5098 | static ssize_t mem_cgroup_read(struct cgroup_subsys_state *css, |
5098 | struct file *file, char __user *buf, | 5099 | struct cftype *cft, struct file *file, |
5099 | size_t nbytes, loff_t *ppos) | 5100 | char __user *buf, size_t nbytes, loff_t *ppos) |
5100 | { | 5101 | { |
5101 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5102 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5102 | char str[64]; | 5103 | char str[64]; |
5103 | u64 val; | 5104 | u64 val; |
5104 | int name, len; | 5105 | int name, len; |
@@ -5131,11 +5132,11 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft, | |||
5131 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); | 5132 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); |
5132 | } | 5133 | } |
5133 | 5134 | ||
5134 | static int memcg_update_kmem_limit(struct cgroup *cont, u64 val) | 5135 | static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val) |
5135 | { | 5136 | { |
5136 | int ret = -EINVAL; | 5137 | int ret = -EINVAL; |
5137 | #ifdef CONFIG_MEMCG_KMEM | 5138 | #ifdef CONFIG_MEMCG_KMEM |
5138 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5139 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5139 | /* | 5140 | /* |
5140 | * For simplicity, we won't allow this to be disabled. It also can't | 5141 | * For simplicity, we won't allow this to be disabled. It also can't |
5141 | * be changed if the cgroup has children already, or if tasks had | 5142 | * be changed if the cgroup has children already, or if tasks had |
@@ -5151,7 +5152,7 @@ static int memcg_update_kmem_limit(struct cgroup *cont, u64 val) | |||
5151 | mutex_lock(&memcg_create_mutex); | 5152 | mutex_lock(&memcg_create_mutex); |
5152 | mutex_lock(&set_limit_mutex); | 5153 | mutex_lock(&set_limit_mutex); |
5153 | if (!memcg->kmem_account_flags && val != RESOURCE_MAX) { | 5154 | if (!memcg->kmem_account_flags && val != RESOURCE_MAX) { |
5154 | if (cgroup_task_count(cont) || memcg_has_children(memcg)) { | 5155 | if (cgroup_task_count(css->cgroup) || memcg_has_children(memcg)) { |
5155 | ret = -EBUSY; | 5156 | ret = -EBUSY; |
5156 | goto out; | 5157 | goto out; |
5157 | } | 5158 | } |
@@ -5221,10 +5222,10 @@ out: | |||
5221 | * The user of this function is... | 5222 | * The user of this function is... |
5222 | * RES_LIMIT. | 5223 | * RES_LIMIT. |
5223 | */ | 5224 | */ |
5224 | static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft, | 5225 | static int mem_cgroup_write(struct cgroup_subsys_state *css, struct cftype *cft, |
5225 | const char *buffer) | 5226 | const char *buffer) |
5226 | { | 5227 | { |
5227 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5228 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5228 | enum res_type type; | 5229 | enum res_type type; |
5229 | int name; | 5230 | int name; |
5230 | unsigned long long val; | 5231 | unsigned long long val; |
@@ -5248,7 +5249,7 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft, | |||
5248 | else if (type == _MEMSWAP) | 5249 | else if (type == _MEMSWAP) |
5249 | ret = mem_cgroup_resize_memsw_limit(memcg, val); | 5250 | ret = mem_cgroup_resize_memsw_limit(memcg, val); |
5250 | else if (type == _KMEM) | 5251 | else if (type == _KMEM) |
5251 | ret = memcg_update_kmem_limit(cont, val); | 5252 | ret = memcg_update_kmem_limit(css, val); |
5252 | else | 5253 | else |
5253 | return -EINVAL; | 5254 | return -EINVAL; |
5254 | break; | 5255 | break; |
@@ -5297,9 +5298,9 @@ out: | |||
5297 | *memsw_limit = min_memsw_limit; | 5298 | *memsw_limit = min_memsw_limit; |
5298 | } | 5299 | } |
5299 | 5300 | ||
5300 | static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) | 5301 | static int mem_cgroup_reset(struct cgroup_subsys_state *css, unsigned int event) |
5301 | { | 5302 | { |
5302 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5303 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5303 | int name; | 5304 | int name; |
5304 | enum res_type type; | 5305 | enum res_type type; |
5305 | 5306 | ||
@@ -5332,17 +5333,17 @@ static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) | |||
5332 | return 0; | 5333 | return 0; |
5333 | } | 5334 | } |
5334 | 5335 | ||
5335 | static u64 mem_cgroup_move_charge_read(struct cgroup *cgrp, | 5336 | static u64 mem_cgroup_move_charge_read(struct cgroup_subsys_state *css, |
5336 | struct cftype *cft) | 5337 | struct cftype *cft) |
5337 | { | 5338 | { |
5338 | return mem_cgroup_from_cont(cgrp)->move_charge_at_immigrate; | 5339 | return mem_cgroup_from_css(css)->move_charge_at_immigrate; |
5339 | } | 5340 | } |
5340 | 5341 | ||
5341 | #ifdef CONFIG_MMU | 5342 | #ifdef CONFIG_MMU |
5342 | static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | 5343 | static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, |
5343 | struct cftype *cft, u64 val) | 5344 | struct cftype *cft, u64 val) |
5344 | { | 5345 | { |
5345 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5346 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5346 | 5347 | ||
5347 | if (val >= (1 << NR_MOVE_TYPE)) | 5348 | if (val >= (1 << NR_MOVE_TYPE)) |
5348 | return -EINVAL; | 5349 | return -EINVAL; |
@@ -5357,7 +5358,7 @@ static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | |||
5357 | return 0; | 5358 | return 0; |
5358 | } | 5359 | } |
5359 | #else | 5360 | #else |
5360 | static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | 5361 | static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, |
5361 | struct cftype *cft, u64 val) | 5362 | struct cftype *cft, u64 val) |
5362 | { | 5363 | { |
5363 | return -ENOSYS; | 5364 | return -ENOSYS; |
@@ -5365,13 +5366,13 @@ static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | |||
5365 | #endif | 5366 | #endif |
5366 | 5367 | ||
5367 | #ifdef CONFIG_NUMA | 5368 | #ifdef CONFIG_NUMA |
5368 | static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft, | 5369 | static int memcg_numa_stat_show(struct cgroup_subsys_state *css, |
5369 | struct seq_file *m) | 5370 | struct cftype *cft, struct seq_file *m) |
5370 | { | 5371 | { |
5371 | int nid; | 5372 | int nid; |
5372 | unsigned long total_nr, file_nr, anon_nr, unevictable_nr; | 5373 | unsigned long total_nr, file_nr, anon_nr, unevictable_nr; |
5373 | unsigned long node_nr; | 5374 | unsigned long node_nr; |
5374 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5375 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5375 | 5376 | ||
5376 | total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL); | 5377 | total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL); |
5377 | seq_printf(m, "total=%lu", total_nr); | 5378 | seq_printf(m, "total=%lu", total_nr); |
@@ -5416,10 +5417,10 @@ static inline void mem_cgroup_lru_names_not_uptodate(void) | |||
5416 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); | 5417 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); |
5417 | } | 5418 | } |
5418 | 5419 | ||
5419 | static int memcg_stat_show(struct cgroup *cont, struct cftype *cft, | 5420 | static int memcg_stat_show(struct cgroup_subsys_state *css, struct cftype *cft, |
5420 | struct seq_file *m) | 5421 | struct seq_file *m) |
5421 | { | 5422 | { |
5422 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5423 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5423 | struct mem_cgroup *mi; | 5424 | struct mem_cgroup *mi; |
5424 | unsigned int i; | 5425 | unsigned int i; |
5425 | 5426 | ||
@@ -5503,17 +5504,18 @@ static int memcg_stat_show(struct cgroup *cont, struct cftype *cft, | |||
5503 | return 0; | 5504 | return 0; |
5504 | } | 5505 | } |
5505 | 5506 | ||
5506 | static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft) | 5507 | static u64 mem_cgroup_swappiness_read(struct cgroup_subsys_state *css, |
5508 | struct cftype *cft) | ||
5507 | { | 5509 | { |
5508 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5510 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5509 | 5511 | ||
5510 | return mem_cgroup_swappiness(memcg); | 5512 | return mem_cgroup_swappiness(memcg); |
5511 | } | 5513 | } |
5512 | 5514 | ||
5513 | static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, | 5515 | static int mem_cgroup_swappiness_write(struct cgroup_subsys_state *css, |
5514 | u64 val) | 5516 | struct cftype *cft, u64 val) |
5515 | { | 5517 | { |
5516 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5518 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5517 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); | 5519 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); |
5518 | 5520 | ||
5519 | if (val > 100 || !parent) | 5521 | if (val > 100 || !parent) |
@@ -5829,10 +5831,10 @@ static void mem_cgroup_oom_unregister_event(struct cgroup *cgrp, | |||
5829 | spin_unlock(&memcg_oom_lock); | 5831 | spin_unlock(&memcg_oom_lock); |
5830 | } | 5832 | } |
5831 | 5833 | ||
5832 | static int mem_cgroup_oom_control_read(struct cgroup *cgrp, | 5834 | static int mem_cgroup_oom_control_read(struct cgroup_subsys_state *css, |
5833 | struct cftype *cft, struct cgroup_map_cb *cb) | 5835 | struct cftype *cft, struct cgroup_map_cb *cb) |
5834 | { | 5836 | { |
5835 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5837 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5836 | 5838 | ||
5837 | cb->fill(cb, "oom_kill_disable", memcg->oom_kill_disable); | 5839 | cb->fill(cb, "oom_kill_disable", memcg->oom_kill_disable); |
5838 | 5840 | ||
@@ -5843,10 +5845,10 @@ static int mem_cgroup_oom_control_read(struct cgroup *cgrp, | |||
5843 | return 0; | 5845 | return 0; |
5844 | } | 5846 | } |
5845 | 5847 | ||
5846 | static int mem_cgroup_oom_control_write(struct cgroup *cgrp, | 5848 | static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css, |
5847 | struct cftype *cft, u64 val) | 5849 | struct cftype *cft, u64 val) |
5848 | { | 5850 | { |
5849 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5851 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5850 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); | 5852 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); |
5851 | 5853 | ||
5852 | /* cannot set to root cgroup and only 0 and 1 are allowed */ | 5854 | /* cannot set to root cgroup and only 0 and 1 are allowed */ |
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 7f1654d3cec7..2a8a736e95cc 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
@@ -81,8 +81,8 @@ static struct vmpressure *cg_to_vmpressure(struct cgroup *cg) | |||
81 | 81 | ||
82 | static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr) | 82 | static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr) |
83 | { | 83 | { |
84 | struct cgroup *cg = vmpressure_to_css(vmpr)->cgroup; | 84 | struct cgroup_subsys_state *css = vmpressure_to_css(vmpr); |
85 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cg); | 85 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
86 | 86 | ||
87 | memcg = parent_mem_cgroup(memcg); | 87 | memcg = parent_mem_cgroup(memcg); |
88 | if (!memcg) | 88 | if (!memcg) |