diff options
-rw-r--r-- | mm/memcontrol.c | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 3427de9897a5..91b5d3a62059 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -5369,45 +5369,33 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, | |||
5369 | static int memcg_numa_stat_show(struct cgroup_subsys_state *css, | 5369 | static int memcg_numa_stat_show(struct cgroup_subsys_state *css, |
5370 | struct cftype *cft, struct seq_file *m) | 5370 | struct cftype *cft, struct seq_file *m) |
5371 | { | 5371 | { |
5372 | struct numa_stat { | ||
5373 | const char *name; | ||
5374 | unsigned int lru_mask; | ||
5375 | }; | ||
5376 | |||
5377 | static const struct numa_stat stats[] = { | ||
5378 | { "total", LRU_ALL }, | ||
5379 | { "file", LRU_ALL_FILE }, | ||
5380 | { "anon", LRU_ALL_ANON }, | ||
5381 | { "unevictable", BIT(LRU_UNEVICTABLE) }, | ||
5382 | }; | ||
5383 | const struct numa_stat *stat; | ||
5372 | int nid; | 5384 | int nid; |
5373 | unsigned long total_nr, file_nr, anon_nr, unevictable_nr; | 5385 | unsigned long nr; |
5374 | unsigned long node_nr; | ||
5375 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 5386 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
5376 | 5387 | ||
5377 | total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL); | 5388 | for (stat = stats; stat < stats + ARRAY_SIZE(stats); stat++) { |
5378 | seq_printf(m, "total=%lu", total_nr); | 5389 | nr = mem_cgroup_nr_lru_pages(memcg, stat->lru_mask); |
5379 | for_each_node_state(nid, N_MEMORY) { | 5390 | seq_printf(m, "%s=%lu", stat->name, nr); |
5380 | node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, LRU_ALL); | 5391 | for_each_node_state(nid, N_MEMORY) { |
5381 | seq_printf(m, " N%d=%lu", nid, node_nr); | 5392 | nr = mem_cgroup_node_nr_lru_pages(memcg, nid, |
5382 | } | 5393 | stat->lru_mask); |
5383 | seq_putc(m, '\n'); | 5394 | seq_printf(m, " N%d=%lu", nid, nr); |
5384 | 5395 | } | |
5385 | file_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_FILE); | 5396 | seq_putc(m, '\n'); |
5386 | seq_printf(m, "file=%lu", file_nr); | ||
5387 | for_each_node_state(nid, N_MEMORY) { | ||
5388 | node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, | ||
5389 | LRU_ALL_FILE); | ||
5390 | seq_printf(m, " N%d=%lu", nid, node_nr); | ||
5391 | } | ||
5392 | seq_putc(m, '\n'); | ||
5393 | |||
5394 | anon_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_ANON); | ||
5395 | seq_printf(m, "anon=%lu", anon_nr); | ||
5396 | for_each_node_state(nid, N_MEMORY) { | ||
5397 | node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, | ||
5398 | LRU_ALL_ANON); | ||
5399 | seq_printf(m, " N%d=%lu", nid, node_nr); | ||
5400 | } | 5397 | } |
5401 | seq_putc(m, '\n'); | ||
5402 | 5398 | ||
5403 | unevictable_nr = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_UNEVICTABLE)); | ||
5404 | seq_printf(m, "unevictable=%lu", unevictable_nr); | ||
5405 | for_each_node_state(nid, N_MEMORY) { | ||
5406 | node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, | ||
5407 | BIT(LRU_UNEVICTABLE)); | ||
5408 | seq_printf(m, " N%d=%lu", nid, node_nr); | ||
5409 | } | ||
5410 | seq_putc(m, '\n'); | ||
5411 | return 0; | 5399 | return 0; |
5412 | } | 5400 | } |
5413 | #endif /* CONFIG_NUMA */ | 5401 | #endif /* CONFIG_NUMA */ |