diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c7d78eca8363..8d2e5c8a25b1 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1782,6 +1782,34 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft, | |||
1782 | return ret; | 1782 | return ret; |
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, | ||
1786 | unsigned long long *mem_limit, unsigned long long *memsw_limit) | ||
1787 | { | ||
1788 | struct cgroup *cgroup; | ||
1789 | unsigned long long min_limit, min_memsw_limit, tmp; | ||
1790 | |||
1791 | min_limit = res_counter_read_u64(&memcg->res, RES_LIMIT); | ||
1792 | min_memsw_limit = res_counter_read_u64(&memcg->memsw, RES_LIMIT); | ||
1793 | cgroup = memcg->css.cgroup; | ||
1794 | if (!memcg->use_hierarchy) | ||
1795 | goto out; | ||
1796 | |||
1797 | while (cgroup->parent) { | ||
1798 | cgroup = cgroup->parent; | ||
1799 | memcg = mem_cgroup_from_cont(cgroup); | ||
1800 | if (!memcg->use_hierarchy) | ||
1801 | break; | ||
1802 | tmp = res_counter_read_u64(&memcg->res, RES_LIMIT); | ||
1803 | min_limit = min(min_limit, tmp); | ||
1804 | tmp = res_counter_read_u64(&memcg->memsw, RES_LIMIT); | ||
1805 | min_memsw_limit = min(min_memsw_limit, tmp); | ||
1806 | } | ||
1807 | out: | ||
1808 | *mem_limit = min_limit; | ||
1809 | *memsw_limit = min_memsw_limit; | ||
1810 | return; | ||
1811 | } | ||
1812 | |||
1785 | static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) | 1813 | static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) |
1786 | { | 1814 | { |
1787 | struct mem_cgroup *mem; | 1815 | struct mem_cgroup *mem; |
@@ -1855,6 +1883,13 @@ static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, | |||
1855 | cb->fill(cb, "unevictable", unevictable * PAGE_SIZE); | 1883 | cb->fill(cb, "unevictable", unevictable * PAGE_SIZE); |
1856 | 1884 | ||
1857 | } | 1885 | } |
1886 | { | ||
1887 | unsigned long long limit, memsw_limit; | ||
1888 | memcg_get_hierarchical_limit(mem_cont, &limit, &memsw_limit); | ||
1889 | cb->fill(cb, "hierarchical_memory_limit", limit); | ||
1890 | if (do_swap_account) | ||
1891 | cb->fill(cb, "hierarchical_memsw_limit", memsw_limit); | ||
1892 | } | ||
1858 | 1893 | ||
1859 | #ifdef CONFIG_DEBUG_VM | 1894 | #ifdef CONFIG_DEBUG_VM |
1860 | cb->fill(cb, "inactive_ratio", calc_inactive_ratio(mem_cont, NULL)); | 1895 | cb->fill(cb, "inactive_ratio", calc_inactive_ratio(mem_cont, NULL)); |