diff options
author | Tejun Heo <tj@kernel.org> | 2013-12-05 12:28:04 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-12-05 12:28:04 -0500 |
commit | 2da8ca822d49c8b8781800ad155aaa00e7bb5f1a (patch) | |
tree | 9ec6b0a7a009d76d0c607640eae64d3e9ed666a9 /mm/memcontrol.c | |
parent | 7da112792753d71aed44b918395892a1fc53048a (diff) |
cgroup: replace cftype->read_seq_string() with cftype->seq_show()
In preparation of conversion to kernfs, cgroup file handling is
updated so that it can be easily mapped to kernfs. This patch
replaces cftype->read_seq_string() with cftype->seq_show() which is
not limited to single_open() operation and will map directcly to
kernfs seq_file interface.
The conversions are mechanical. As ->seq_show() doesn't have @css and
@cft, the functions which make use of them are converted to use
seq_css() and seq_cft() respectively. In several occassions, e.f. if
it has seq_string in its name, the function name is updated to fit the
new method better.
This patch does not introduce any behavior changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Aristeu Rozanski <arozansk@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f149521a77e6..9252219376cc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3014,10 +3014,9 @@ static struct kmem_cache *memcg_params_to_cache(struct memcg_cache_params *p) | |||
3014 | } | 3014 | } |
3015 | 3015 | ||
3016 | #ifdef CONFIG_SLABINFO | 3016 | #ifdef CONFIG_SLABINFO |
3017 | static int mem_cgroup_slabinfo_read(struct cgroup_subsys_state *css, | 3017 | static int mem_cgroup_slabinfo_read(struct seq_file *m, void *v) |
3018 | struct cftype *cft, struct seq_file *m) | ||
3019 | { | 3018 | { |
3020 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 3019 | struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); |
3021 | struct memcg_cache_params *params; | 3020 | struct memcg_cache_params *params; |
3022 | 3021 | ||
3023 | if (!memcg_can_account_kmem(memcg)) | 3022 | if (!memcg_can_account_kmem(memcg)) |
@@ -5418,8 +5417,7 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, | |||
5418 | #endif | 5417 | #endif |
5419 | 5418 | ||
5420 | #ifdef CONFIG_NUMA | 5419 | #ifdef CONFIG_NUMA |
5421 | static int memcg_numa_stat_show(struct cgroup_subsys_state *css, | 5420 | static int memcg_numa_stat_show(struct seq_file *m, void *v) |
5422 | struct cftype *cft, struct seq_file *m) | ||
5423 | { | 5421 | { |
5424 | struct numa_stat { | 5422 | struct numa_stat { |
5425 | const char *name; | 5423 | const char *name; |
@@ -5435,7 +5433,7 @@ static int memcg_numa_stat_show(struct cgroup_subsys_state *css, | |||
5435 | const struct numa_stat *stat; | 5433 | const struct numa_stat *stat; |
5436 | int nid; | 5434 | int nid; |
5437 | unsigned long nr; | 5435 | unsigned long nr; |
5438 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 5436 | struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); |
5439 | 5437 | ||
5440 | for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { | 5438 | for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { |
5441 | nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask); | 5439 | nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask); |
@@ -5474,10 +5472,9 @@ static inline void mem_cgroup_lru_names_not_uptodate(void) | |||
5474 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); | 5472 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); |
5475 | } | 5473 | } |
5476 | 5474 | ||
5477 | static int memcg_stat_show(struct cgroup_subsys_state *css, struct cftype *cft, | 5475 | static int memcg_stat_show(struct seq_file *m, void *v) |
5478 | struct seq_file *m) | ||
5479 | { | 5476 | { |
5480 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 5477 | struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m)); |
5481 | struct mem_cgroup *mi; | 5478 | struct mem_cgroup *mi; |
5482 | unsigned int i; | 5479 | unsigned int i; |
5483 | 5480 | ||
@@ -5907,10 +5904,9 @@ static void mem_cgroup_oom_unregister_event(struct mem_cgroup *memcg, | |||
5907 | spin_unlock(&memcg_oom_lock); | 5904 | spin_unlock(&memcg_oom_lock); |
5908 | } | 5905 | } |
5909 | 5906 | ||
5910 | static int mem_cgroup_oom_control_read(struct cgroup_subsys_state *css, | 5907 | static int mem_cgroup_oom_control_read(struct seq_file *sf, void *v) |
5911 | struct cftype *cft, struct seq_file *sf) | ||
5912 | { | 5908 | { |
5913 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 5909 | struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(sf)); |
5914 | 5910 | ||
5915 | seq_printf(sf, "oom_kill_disable %d\n", memcg->oom_kill_disable); | 5911 | seq_printf(sf, "oom_kill_disable %d\n", memcg->oom_kill_disable); |
5916 | seq_printf(sf, "under_oom %d\n", (bool)atomic_read(&memcg->under_oom)); | 5912 | seq_printf(sf, "under_oom %d\n", (bool)atomic_read(&memcg->under_oom)); |
@@ -6260,7 +6256,7 @@ static struct cftype mem_cgroup_files[] = { | |||
6260 | }, | 6256 | }, |
6261 | { | 6257 | { |
6262 | .name = "stat", | 6258 | .name = "stat", |
6263 | .read_seq_string = memcg_stat_show, | 6259 | .seq_show = memcg_stat_show, |
6264 | }, | 6260 | }, |
6265 | { | 6261 | { |
6266 | .name = "force_empty", | 6262 | .name = "force_empty", |
@@ -6290,7 +6286,7 @@ static struct cftype mem_cgroup_files[] = { | |||
6290 | }, | 6286 | }, |
6291 | { | 6287 | { |
6292 | .name = "oom_control", | 6288 | .name = "oom_control", |
6293 | .read_seq_string = mem_cgroup_oom_control_read, | 6289 | .seq_show = mem_cgroup_oom_control_read, |
6294 | .write_u64 = mem_cgroup_oom_control_write, | 6290 | .write_u64 = mem_cgroup_oom_control_write, |
6295 | .private = MEMFILE_PRIVATE(_OOM_TYPE, OOM_CONTROL), | 6291 | .private = MEMFILE_PRIVATE(_OOM_TYPE, OOM_CONTROL), |
6296 | }, | 6292 | }, |
@@ -6300,7 +6296,7 @@ static struct cftype mem_cgroup_files[] = { | |||
6300 | #ifdef CONFIG_NUMA | 6296 | #ifdef CONFIG_NUMA |
6301 | { | 6297 | { |
6302 | .name = "numa_stat", | 6298 | .name = "numa_stat", |
6303 | .read_seq_string = memcg_numa_stat_show, | 6299 | .seq_show = memcg_numa_stat_show, |
6304 | }, | 6300 | }, |
6305 | #endif | 6301 | #endif |
6306 | #ifdef CONFIG_MEMCG_KMEM | 6302 | #ifdef CONFIG_MEMCG_KMEM |
@@ -6330,7 +6326,7 @@ static struct cftype mem_cgroup_files[] = { | |||
6330 | #ifdef CONFIG_SLABINFO | 6326 | #ifdef CONFIG_SLABINFO |
6331 | { | 6327 | { |
6332 | .name = "kmem.slabinfo", | 6328 | .name = "kmem.slabinfo", |
6333 | .read_seq_string = mem_cgroup_slabinfo_read, | 6329 | .seq_show = mem_cgroup_slabinfo_read, |
6334 | }, | 6330 | }, |
6335 | #endif | 6331 | #endif |
6336 | #endif | 6332 | #endif |