diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index fbb60b103e64..07bf3ec13a07 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -120,6 +120,14 @@ static const char * const mem_cgroup_events_names[] = { | |||
120 | "pgmajfault", | 120 | "pgmajfault", |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static const char * const mem_cgroup_lru_names[] = { | ||
124 | "inactive_anon", | ||
125 | "active_anon", | ||
126 | "inactive_file", | ||
127 | "active_file", | ||
128 | "unevictable", | ||
129 | }; | ||
130 | |||
123 | /* | 131 | /* |
124 | * Per memcg event counter is incremented at every pagein/pageout. With THP, | 132 | * Per memcg event counter is incremented at every pagein/pageout. With THP, |
125 | * it will be incremated by the number of pages. This counter is used for | 133 | * it will be incremated by the number of pages. This counter is used for |
@@ -1524,8 +1532,9 @@ static void move_unlock_mem_cgroup(struct mem_cgroup *memcg, | |||
1524 | spin_unlock_irqrestore(&memcg->move_lock, *flags); | 1532 | spin_unlock_irqrestore(&memcg->move_lock, *flags); |
1525 | } | 1533 | } |
1526 | 1534 | ||
1535 | #define K(x) ((x) << (PAGE_SHIFT-10)) | ||
1527 | /** | 1536 | /** |
1528 | * mem_cgroup_print_oom_info: Called from OOM with tasklist_lock held in read mode. | 1537 | * mem_cgroup_print_oom_info: Print OOM information relevant to memory controller. |
1529 | * @memcg: The memory cgroup that went over limit | 1538 | * @memcg: The memory cgroup that went over limit |
1530 | * @p: Task that is going to be killed | 1539 | * @p: Task that is going to be killed |
1531 | * | 1540 | * |
@@ -1543,8 +1552,10 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1543 | */ | 1552 | */ |
1544 | static char memcg_name[PATH_MAX]; | 1553 | static char memcg_name[PATH_MAX]; |
1545 | int ret; | 1554 | int ret; |
1555 | struct mem_cgroup *iter; | ||
1556 | unsigned int i; | ||
1546 | 1557 | ||
1547 | if (!memcg || !p) | 1558 | if (!p) |
1548 | return; | 1559 | return; |
1549 | 1560 | ||
1550 | rcu_read_lock(); | 1561 | rcu_read_lock(); |
@@ -1592,6 +1603,30 @@ done: | |||
1592 | res_counter_read_u64(&memcg->kmem, RES_USAGE) >> 10, | 1603 | res_counter_read_u64(&memcg->kmem, RES_USAGE) >> 10, |
1593 | res_counter_read_u64(&memcg->kmem, RES_LIMIT) >> 10, | 1604 | res_counter_read_u64(&memcg->kmem, RES_LIMIT) >> 10, |
1594 | res_counter_read_u64(&memcg->kmem, RES_FAILCNT)); | 1605 | res_counter_read_u64(&memcg->kmem, RES_FAILCNT)); |
1606 | |||
1607 | for_each_mem_cgroup_tree(iter, memcg) { | ||
1608 | pr_info("Memory cgroup stats"); | ||
1609 | |||
1610 | rcu_read_lock(); | ||
1611 | ret = cgroup_path(iter->css.cgroup, memcg_name, PATH_MAX); | ||
1612 | if (!ret) | ||
1613 | pr_cont(" for %s", memcg_name); | ||
1614 | rcu_read_unlock(); | ||
1615 | pr_cont(":"); | ||
1616 | |||
1617 | for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) { | ||
1618 | if (i == MEM_CGROUP_STAT_SWAP && !do_swap_account) | ||
1619 | continue; | ||
1620 | pr_cont(" %s:%ldKB", mem_cgroup_stat_names[i], | ||
1621 | K(mem_cgroup_read_stat(iter, i))); | ||
1622 | } | ||
1623 | |||
1624 | for (i = 0; i < NR_LRU_LISTS; i++) | ||
1625 | pr_cont(" %s:%luKB", mem_cgroup_lru_names[i], | ||
1626 | K(mem_cgroup_nr_lru_pages(iter, BIT(i)))); | ||
1627 | |||
1628 | pr_cont("\n"); | ||
1629 | } | ||
1595 | } | 1630 | } |
1596 | 1631 | ||
1597 | /* | 1632 | /* |
@@ -5214,14 +5249,6 @@ static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft, | |||
5214 | } | 5249 | } |
5215 | #endif /* CONFIG_NUMA */ | 5250 | #endif /* CONFIG_NUMA */ |
5216 | 5251 | ||
5217 | static const char * const mem_cgroup_lru_names[] = { | ||
5218 | "inactive_anon", | ||
5219 | "active_anon", | ||
5220 | "inactive_file", | ||
5221 | "active_file", | ||
5222 | "unevictable", | ||
5223 | }; | ||
5224 | |||
5225 | static inline void mem_cgroup_lru_names_not_uptodate(void) | 5252 | static inline void mem_cgroup_lru_names_not_uptodate(void) |
5226 | { | 5253 | { |
5227 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); | 5254 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); |